thomasin / elm-frontmatter / Content.Decode.Markdown

Decode a field into a List Markdown.Block.Block from the dillonkearns/elm-markdown package.

This lets you do some pretty cool things! To render the Markdown blocks into HTML, see Markdown.Renderer

decode : Content.Decode.Decoder (List Markdown.Block.Block)

decoder : Content.Type.Path -> Content.Decode.QueryResult
decoder typePath =
    case typePath of
        Content.Type.Single [ "Content", "Index" ] ->
            Content.Decode.frontmatter Content.Decode.Markdown.decode
                [ Content.Decode.attribute "title" Content.Decode.string
                , Content.Decode.attribute "description" Content.Decode.string
                ]

        _ ->
            Content.Decode.throw