jot

Types

pub type Container {
  ThematicBreak
  Paragraph(attributes: Dict(String, String), List(Inline))
  Heading(
    attributes: Dict(String, String),
    level: Int,
    content: List(Inline),
  )
  Codeblock(
    attributes: Dict(String, String),
    language: Option(String),
    content: String,
  )
}

Constructors

  • ThematicBreak
  • Paragraph(attributes: Dict(String, String), List(Inline))
  • Heading(
      attributes: Dict(String, String),
      level: Int,
      content: List(Inline),
    )
  • Codeblock(
      attributes: Dict(String, String),
      language: Option(String),
      content: String,
    )
pub type Destination {
  Reference(String)
  Url(String)
}

Constructors

  • Reference(String)
  • Url(String)
pub type Document {
  Document(
    content: List(Container),
    references: Dict(String, String),
  )
}

Constructors

  • Document(
      content: List(Container),
      references: Dict(String, String),
    )
pub type Inline {
  Linebreak
  Text(String)
  Link(content: List(Inline), destination: Destination)
  Image(content: List(Inline), destination: Destination)
  Emphasis(content: List(Inline))
  Strong(content: List(Inline))
  Code(content: String)
}

Constructors

  • Linebreak
  • Text(String)
  • Link(content: List(Inline), destination: Destination)
  • Image(content: List(Inline), destination: Destination)
  • Emphasis(content: List(Inline))
  • Strong(content: List(Inline))
  • Code(content: String)

Functions

pub fn document_to_html(document: Document) -> String

Convert a document tree into a string of HTML.

pub fn parse(djot: String) -> Document

Convert a string of Djot into a tree of records.

This may be useful when you want more control over the HTML to be converted to, or you wish to convert Djot to some other format.

pub fn to_html(djot: String) -> String

Convert a string of Djot into a string of HTML.

If you want to have more control over the HTML generated you can use the parse function to convert Djot to a tree of records instead. You can then traverse this tree and turn it into HTML yourself.

Search Document