Explorer

markdown.block-nodes

description
The HTML nodes of a finished Markdown block
type
Fn(block: @markdown.block, doc_prefix: String) -> List<@html.node>
expression
fn(block$0, doc_prefix$1) =>
  match $0 {
    #none(_) =>
      [],
    #paragraph(lines$2) =>
      [
        @html.element(
          name: "p",
          attributes: [],
          children: @markdown.inline(text: @std.string-join(items: $2, separator: "\n"), doc_prefix: $1)
        )
      ],
    #code(lines$3) =>
      [
        @html.element(
          name: "pre",
          attributes: [],
          children: [
            @html.element(
              name: "code",
              attributes: [],
              children: [@html.text(text: @std.string-join(items: $3, separator: "\n"))]
            )
          ]
        )
      ],
    #list(list$4) =>
      [
        @html.element(
          name: match $4.ordered {
            true =>
              "ol",
            false =>
              "ul"
          },
          attributes: [],
          children: @core.list-map(
            T: String,
            U: @html.node,
            f: fn(item$5) =>
              @html.element(name: "li", attributes: [], children: @markdown.inline(text: $5, doc_prefix: $1)),
            xs: $4.items
          )
        )
      ],
    #table(rows$6) =>
      [@markdown.table(rows: $6, doc_prefix: $1)],
    #quote(lines$7) =>
      [
        @html.element(
          name: "blockquote",
          attributes: [],
          children: @markdown.to-html(text: @std.string-join(items: $7, separator: "\n"), doc_prefix: $1)
        )
      ]
  }
visibility
public
markdown.block-nodes (project markdown, branch main, snapshot A_DQB42norQipCLzT0TSP-ZbZiC-EXHKoYK6tAFWTC0)
id: rYIz1JjT30-HOoZBdxgSCO-n7_5tolE9li2UovLA1fU
content hash: jP0k6HV2F1oYK4ACrT88PVvkoOTHtAHZRYdhuH1zugU