1
1
mirror of https://github.com/srid/ema.git synced 2024-11-30 13:01:56 +03:00

docs: remove outdated

This commit is contained in:
Sridhar Ratnakumar 2022-06-11 11:22:04 -04:00
parent 05eea086b9
commit cccd41311c
8 changed files with 4 additions and 73 deletions

View File

@ -1,8 +0,0 @@
---
order: 2
---
# LVar
If you are familiar with Haskell's `stm` package, a `LVar` is essentially a [`TMVar`](https://hackage.haskell.org/package/stm-2.5.0.0/docs/Control-Concurrent-STM-TMVar.html) but with an extra ability for other threads to observe changes. Ema uses it for [hot reload](concepts/hot-reload.md), and your application code is expected to set and update its [model](guide/model.md) through the LVar.
Documentation on `LVar` is available [on Hackage](https://hackage.haskell.org/package/lvar).

View File

@ -1,20 +0,0 @@
---
order: 3
---
# Slug
:::{.note}
Note that the initial version of Ema used Slug in its routing system, but not anymore in the latest version. The Slug type is still left in the library for using as a helper.
:::
A slug is a component of a URL or file path. In an _URL_ like `/foo/bar`, there are two _slugs_: "foo" and "bar". URLs (as well as filepaths) can therefore be represented as lists of slugs (`[Slug]`).
```haskell
import Ema (Slug)
type URL = [Slug]
```
Slugs are automatically [unicode normalized](https://www.unicode.org/faq/normalization.html) to NFC to ensure that route links work reliably regardless of the underlying representation of any non-ascii link text.
The functions `decodeSlug` and `encodeSlug` allow you to convert between URLs and slugs.

View File

@ -10,4 +10,3 @@ After having familiarized yourself with Ema by following the [earlier section](s
* [Working with routes](guide/routes.md) -- [Unless you site has a single page (`index.html`), you will need to manage a set of routes]{.item-intro}
* [Defining Ema instance](guide/class.md) -- [Constrain your `model` and `route` to work with static sites]{.item-intro}
* [Rendering HTML](guide/render.md) -- [You could use plain strings to build HTML, or use templates, or use one of the delightful Haskell DSLs]{.item-intro}
* [[howto]] -- [How to do common static-site things]{.item-intro}

View File

@ -1,3 +1,6 @@
---
order: 100
---
# Upgrading to newer Ema

View File

@ -1,9 +0,0 @@
---
order: 5
---
# Howto
Beyond the model and route types, Ema leaves it up to you as to how to develop your site. Here are some common aspects of writing a static site:
* [[filesystem|Working with files]] -- [Use `unionmount` to support hot-reload on files]{.item-intro}
* [[markdown|Parsing Markdown]] -- [Pointers on how to work with Markdown files]{.item-intro}

View File

@ -1,34 +0,0 @@
---
order: 3
---
# Using Markdown
There are quite a few packages to convert Markdown to HTML,
- [Pandoc](https://hackage.haskell.org/package/pandoc) -- [Supports formats other than Markdown]{.item-intro}
- [commonmark-hs](https://github.com/jgm/commonmark-hs) -- [Lightweight parser by the same author of Pandoc]{.item-intro}
- [commonmark-simple](https://hackage.haskell.org/package/commonmark-simple-0.1.0.0) -- [Simpler interface to the above, with frontmatter support]{.item-intro}
- [mmark](https://github.com/mmark-md/mmark) -- [*Strict* Markdown parser]{.item-intro}
## `commonmark-simple`
`commonmark-simple` uses commonmark-hs to provide a simpler API, along with front matter support. If you are parsing front matter, you can use any type that has a [`FromYAML`](https://hackage.haskell.org/package/HsYAML-0.2.1.0/docs/Data-YAML.html#t:FromYAML) instance.
```haskell
import qualified Commonmark.Simple as CS
-- Front matter metadata can be any type with a `FromYAML` instance
--
-- Using a `Map` is a lazy way to capture metadata, but in real code we
-- generally define a sum type and manually derive `FromYAML` for it.
type Metadata = Map Text Text
-- Returns `Either Text (Metadata, Pandoc)`
CS.parseMarkdownWithFrontMatter @Metadata
"test.md" "Hello *world*"
```
The template repo, as well as [Emanote](https://github.com/srid/emanote) (used to generate this site), uses this helper to parse Markdown files into Pandoc AST. Consult [the template repo's source code](https://github.com/srid/ema-template/blob/master/src/Main.hs) for details.
Note that with Ema you can get [hot reload](concepts/hot-reload.md) support for your Markdown files using [[filesystem|the `unionmount` package]].

View File

@ -17,6 +17,6 @@ That should start the Ema dev server displaying a simple website. Go ahead and t
{.last}
[Next]{.next}, [in the tutorial](start/tutorial.md) let's try using this template repo to create a basic website.
[^nix]: Nix is optional. The [template repository][ema-template] will work with plain `cabal`.
[^nix]: Nix is optional, though it provides the best development experience. The [template repository][ema-template] may work with plain `cabal`, but this is not officially tested.
[ema-template]: https://github.com/srid/ema-template