Skip to content

Is it possible to generate an HTML AST from Markdown? #926

Open
@njlr

Description

@njlr

I would like to parse some Markdown, convert it to HTML, embed that in some other HTML and render it all to an HTML string.

Something like this:

// Not real code

let markdown = Markdown.Parse(content)
let markdownHtml = Markdown.toHtmlElement markdown

let page = 
  html
    []
    [
      div [] [ str "This is my header" ]
      markdownHtml
      div [] [ str "This is my footer" ]
    ]

printfn "%s" (Html.toString html)

From the docs, I can see that FSharp.Formatting supports the markdown parsing bit, and can convert to an HTML string, but does it allow one to work with the HTML AST?

The HTML model appears to be internal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions