Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elm-explorations/markdown
Markdown parser available for historical reasons. Will be replaced when we have an Elm implementation!
https://github.com/elm-explorations/markdown
elm markdown
Last synced: about 1 month ago
JSON representation
Markdown parser available for historical reasons. Will be replaced when we have an Elm implementation!
- Host: GitHub
- URL: https://github.com/elm-explorations/markdown
- Owner: elm-explorations
- License: bsd-3-clause
- Created: 2017-09-04T05:36:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-20T13:49:29.000Z (over 6 years ago)
- Last Synced: 2024-08-01T13:22:22.435Z (4 months ago)
- Topics: elm, markdown
- Language: Elm
- Size: 36.1 KB
- Stars: 30
- Watchers: 4
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ccamel - elm-explorations/markdown - Markdown parser available for historical reasons. Will be replaced when we have an Elm implementation! (Elm)
README
# Markdown in Elm
This package is for markdown parsing and rendering. It is based on the [marked][] project
which focuses on speed.[marked]: https://github.com/chjj/marked
## Basic Usage
```elm
content : Html msg
content =
Markdown.toHtml [class "content"] """# Apple Pie Recipe
1. Invent the universe.
2. Bake an apple pie."""
```**Warning:** Calling `Markdown.toHtml` parses the whole block, so try not to
call it for no reason. In the `content` example above we only have to parse
the text once, but if we put it in a function we may be doing a lot of
unnecessary parsing.## Code Blocks
For highlighting any code blocks, the package relies on the
[highlight.js](https://highlightjs.org/) project. So if you want to
see highlighting of code blocks in the rendering result, you need to
make sure that your page/app binds a version of that library
(supporting the languages you want to handle) to `window.hljs` in
Javascript. [This is how package.elm-lang.org does
that.](https://github.com/elm/package.elm-lang.org/blob/e0b7aa4282038475612722ff7a57195866f8645b/backend/ServeFile.hs#L54)