jot
Types
pub type Container {
ThematicBreak
Paragraph(attributes: dict.Dict(String, String), content: List(
Inline,
))
Heading(attributes: dict.Dict(String, String), level: Int, content: List(
Inline,
))
Codeblock(attributes: dict.Dict(String, String), language: option.Option(
String,
), content: String)
RawBlock(content: String)
BulletList(layout: ListLayout, style: String, items: List(
List(Container),
))
}
Constructors
-
ThematicBreak
-
-
-
Codeblock(attributes: dict.Dict(String, String), language: option.Option( String, ), content: String)
-
RawBlock(content: String)
-
BulletList(layout: ListLayout, style: String, items: List( List(Container), ))
pub type Destination {
Reference(String)
Url(String)
}
Constructors
-
Reference(String)
-
Url(String)
pub type Inline {
Linebreak
NonBreakingSpace
Text(String)
Link(content: List(Inline), destination: Destination)
Image(content: List(Inline), destination: Destination)
Emphasis(content: List(Inline))
Strong(content: List(Inline))
Footnote(reference: String)
Code(content: String)
MathInline(content: String)
MathDisplay(content: String)
}
Constructors
-
Linebreak
-
NonBreakingSpace
-
Text(String)
-
Link(content: List(Inline), destination: Destination)
-
Image(content: List(Inline), destination: Destination)
-
Emphasis(content: List(Inline))
-
Strong(content: List(Inline))
-
Footnote(reference: String)
-
Code(content: String)
-
MathInline(content: String)
-
MathDisplay(content: String)
pub type ListLayout {
Tight
Loose
}
Constructors
-
Tight
-
Loose
Values
pub fn document_to_html(document: Document) -> String
Convert a document tree into a string of HTML.
See to_html
for further documentation.
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.
Security
This does not escape the content of raw blocks! If you use this with user-input you likely need to escape raw blocks to prevent cross-site-scripting (XSS) attacks.