mdgriffith/elm-markup/1.0.0

NOTE: the latest version is 3.0.1

Mark

parse : String -> Result (List DeadEnd) (Element msg)
Options
model
{ a
| link : List (Attribute msg)
, token : List (Attribute msg)
, list : List (Attribute msg)
, root : List (Attribute msg)
, block : List (Attribute msg)
}
msg
-> String
-> Result (List DeadEnd) (model -> Element msg)
type alias Options model styling msg =
Options model styling msg
type alias Styling msg =
{ link : List (Attribute msg)
, token : List (Attribute msg)
, list : List (Attribute msg)
, listIcons : Cursor -> ListIcon -> Element msg
, title : List (Attribute msg)
, header : List (Attribute msg)
, monospace : List (Attribute msg)
, root : List (Attribute msg)
, block : List (Attribute msg)
}

Styling options for the default blocks.

If you add custom blocks or inlines, you'll probably want to define a new Styling type.

default : Options model (Styling msg) msg

A default set of block and inline elements as well as some defaultStyling to style them.

defaultStyling : Styling msg
List
(Block
model
{ a
| title : List (Attribute msg)
, header : List (Attribute msg)
, link : List (Attribute msg)
, list : List (Attribute msg)
, root : List (Attribute msg)
, monospace : List (Attribute msg)
, block : List (Attribute msg)
, listIcons : Cursor -> ListIcon -> Element msg
, token : List (Attribute msg)
}
msg
)

A set of common default blocks.

  • title - The title of your document. This is equivalent to an h1. You should only have one of them.
  • header - A header in your document, which is equivalent to h2.
  • list - A nested list with an expected indentation of 4 spaces per level. As far as icons:
    • - indicates a bullet
    • -> indicates an arrow
    • 1. indicates it should be numbered. Any number can work.
  • image - Expects two strings, first the src, and then a description of the image.
  • monospace - Basically a code block without syntax highlighting.

Note none of these are special, they're all defined in terms of Mark.Custom.

type alias Cursor =
( Int, List Int )

A Cursor which represents a position in a nested list.

Level

= Bullet
| Number
| Arrow