tiziano88 / elm-markdown

Markdown parsing within Elm

Home Page:http://package.elm-lang.org/packages/evancz/elm-markdown/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Markdown in Elm

This package is for markdown parsing and rendering. It is based on the marked project which focuses on speed.

Basic Usage

content : Element
content = Markdown.toElement """

# Apple Pie Recipe

  1. Invent the universe.
  2. Bake an apple pie.

"""

Warning: Calling the Markdown.toElement function actually 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 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.

About

Markdown parsing within Elm

http://package.elm-lang.org/packages/evancz/elm-markdown/latest

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Elm 100.0%