Markdown

Markdown

Content values

all : Parser String.Utf8 (List Markdown)

heading : Parser String.Utf8 Markdown

Headings

expect String.parse_str(heading, "# Foo Bar") == Ok(Heading One "Foo Bar")
expect String.parse_str(heading, "Foo Bar\n---") == Ok(Heading Two "Foo Bar")

link : Parser String.Utf8 Markdown

Links

expect String.parse_str(link, "[roc](https://roc-lang.org)") == Ok(Link("roc", "https://roc-lang.org"))

image : Parser String.Utf8 Markdown

Images

expect String.parse_str(image, "![alt text](/images/logo.png)") == Ok(Image("alt text", "/images/logo.png"))

code : Parser String.Utf8 Markdown

Parse code blocks using triple backticks supports block extension e.g. ```roc

expect
    text =
        """
        ```roc
        # some code
        foo = bar
        ```
        """

    a = String.parse_str(code, text)
    a == Ok(Code({ ext: "roc", pre: "# some code\nfoo = bar\n" }))