Module

marksy/ast

src/marksy/ast.pooka

Markdown gets a shape before it gets a costume. Blocks retain addresses in the original UTF-8 source; inline nodes retain the distinctions a renderer needs without keeping the spelling of every delimiter.

Pooka
let text = ast.Text("owl")
let emphasis = ast.Emphasis([text])

API reference

class

Position

src/marksy/ast.pooka:14
class Position(line: Int, column: Int, byte_offset: Int)

Lines and columns count from one; byte offsets count from zero.

field

line

src/marksy/ast.pooka:14
line: Int
INFERREDInt
field

column

src/marksy/ast.pooka:14
column: Int
INFERREDInt
field

byte_offset

src/marksy/ast.pooka:14
byte_offset: Int
INFERREDInt
constructor

new

src/marksy/ast.pooka:14
INFERREDfn(Int, Int, Int) -> marksy/ast.Position
class

Span

src/marksy/ast.pooka:17
class Span(start: Position, end: Position)

A half-open interval: the end is just past the last source character.

field

start

src/marksy/ast.pooka:17
start: Position
field

end

src/marksy/ast.pooka:17
end: Position
constructor

new

src/marksy/ast.pooka:17
class

Document

src/marksy/ast.pooka:20
class Document(blocks: List(Block))

Block children are ordered exactly as they appeared in the source.

field

blocks

src/marksy/ast.pooka:20
blocks: List(Block)
INFERREDList(marksy/ast.Block)
constructor

new

src/marksy/ast.pooka:20
class

Block

src/marksy/ast.pooka:22
class Block
class

Paragraph

src/marksy/ast.pooka:24
class Paragraph(content: List(Inline), span: Span) is Block
field

content

src/marksy/ast.pooka:24
content: List(Inline)
INFERREDList(marksy/ast.Inline)
field

span

src/marksy/ast.pooka:24
span: Span
constructor

new

src/marksy/ast.pooka:24
class

Heading

src/marksy/ast.pooka:26
class Heading(level: Int, content: List(Inline), span: Span) is Block
field

level

src/marksy/ast.pooka:26
level: Int
INFERREDInt
field

content

src/marksy/ast.pooka:26
content: List(Inline)
INFERREDList(marksy/ast.Inline)
field

span

src/marksy/ast.pooka:26
span: Span
constructor

new

src/marksy/ast.pooka:26
class

ThematicBreak

src/marksy/ast.pooka:28
class ThematicBreak(span: Span) is Block
field

span

src/marksy/ast.pooka:28
span: Span
constructor

new

src/marksy/ast.pooka:28
class

CodeBlock

src/marksy/ast.pooka:30
class CodeBlock(code: String, info: String, span: Span) is Block
field

code

src/marksy/ast.pooka:30
code: String
INFERREDString
field

info

src/marksy/ast.pooka:30
info: String
INFERREDString
field

span

src/marksy/ast.pooka:30
span: Span
constructor

new

src/marksy/ast.pooka:30
INFERREDfn(String, String, marksy/ast.Span) -> marksy/ast.CodeBlock
class

BlockQuote

src/marksy/ast.pooka:32
class BlockQuote(blocks: List(Block), span: Span) is Block
field

blocks

src/marksy/ast.pooka:32
blocks: List(Block)
INFERREDList(marksy/ast.Block)
field

span

src/marksy/ast.pooka:32
span: Span
constructor

new

src/marksy/ast.pooka:32
class

ListBlock

src/marksy/ast.pooka:35
class ListBlock(
  ordered: Bool,
  start: Int,
  tight: Bool,
  items: List(ListItem),
  span: Span
) is Block

A list owns its marker family and tightness; nested lists decide their own.

field

ordered

src/marksy/ast.pooka:36
ordered: Bool
INFERREDBool
field

start

src/marksy/ast.pooka:37
start: Int
INFERREDInt
field

tight

src/marksy/ast.pooka:38
tight: Bool
INFERREDBool
field

items

src/marksy/ast.pooka:39
items: List(ListItem)
INFERREDList(marksy/ast.ListItem)
field

span

src/marksy/ast.pooka:40
span: Span
constructor

new

src/marksy/ast.pooka:36
INFERREDfn(Bool, Int, Bool, List(marksy/ast.ListItem), marksy/ast.Span) -> marksy/ast.ListBlock
class

ListItem

src/marksy/ast.pooka:44
class ListItem(blocks: List(Block), span: Span, checked: Option(Bool))

Item children remain ordinary blocks, including nested lists and code.

field

blocks

src/marksy/ast.pooka:44
blocks: List(Block)
INFERREDList(marksy/ast.Block)
field

span

src/marksy/ast.pooka:44
span: Span
field

checked

src/marksy/ast.pooka:44
checked: Option(Bool)
INFERREDOption(Bool)
constructor

new

src/marksy/ast.pooka:44
INFERREDfn(List(marksy/ast.Block), marksy/ast.Span, Option(Bool)) -> marksy/ast.ListItem
class

ReferenceDefinition

src/marksy/ast.pooka:47
class ReferenceDefinition(
  label: String,
  destination: String,
  title: String,
  span: Span
) is Block

Reference definitions disappear after the document-wide resolution pass.

field

label

src/marksy/ast.pooka:48
label: String
INFERREDString
field

destination

src/marksy/ast.pooka:49
destination: String
INFERREDString
field

title

src/marksy/ast.pooka:50
title: String
INFERREDString
field

span

src/marksy/ast.pooka:51
span: Span
constructor

new

src/marksy/ast.pooka:48
INFERREDfn(String, String, String, marksy/ast.Span) -> marksy/ast.ReferenceDefinition
class

SourceInline

src/marksy/ast.pooka:55
class SourceInline(source: String) is Inline

The block pass defers inline parsing until every definition is known.

field

source

src/marksy/ast.pooka:55
source: String
INFERREDString
constructor

new

src/marksy/ast.pooka:55
INFERREDfn(String) -> marksy/ast.SourceInline
class

RawBlock

src/marksy/ast.pooka:57
class RawBlock(html: String, span: Span) is Block
field

html

src/marksy/ast.pooka:57
html: String
INFERREDString
field

span

src/marksy/ast.pooka:57
span: Span
constructor

new

src/marksy/ast.pooka:57
INFERREDfn(String, marksy/ast.Span) -> marksy/ast.RawBlock
class

Inline

src/marksy/ast.pooka:59
class Inline
class

Text

src/marksy/ast.pooka:61
class Text(value: String) is Inline
field

value

src/marksy/ast.pooka:61
value: String
INFERREDString
constructor

new

src/marksy/ast.pooka:61
INFERREDfn(String) -> marksy/ast.Text
class

Code

src/marksy/ast.pooka:63
class Code(value: String) is Inline
field

value

src/marksy/ast.pooka:63
value: String
INFERREDString
constructor

new

src/marksy/ast.pooka:63
INFERREDfn(String) -> marksy/ast.Code
class

SoftBreak

src/marksy/ast.pooka:65
class SoftBreak is Inline
class

HardBreak

src/marksy/ast.pooka:67
class HardBreak is Inline
class

Emphasis

src/marksy/ast.pooka:69
class Emphasis(content: List(Inline)) is Inline
field

content

src/marksy/ast.pooka:69
content: List(Inline)
INFERREDList(marksy/ast.Inline)
constructor

new

src/marksy/ast.pooka:69
class

Strong

src/marksy/ast.pooka:71
class Strong(content: List(Inline)) is Inline
field

content

src/marksy/ast.pooka:71
content: List(Inline)
INFERREDList(marksy/ast.Inline)
constructor

new

src/marksy/ast.pooka:71
class

Link

src/marksy/ast.pooka:73
class Link(content: List(Inline), destination: String, title: String) is Inline
field

content

src/marksy/ast.pooka:73
content: List(Inline)
INFERREDList(marksy/ast.Inline)
field

destination

src/marksy/ast.pooka:73
destination: String
INFERREDString
field

title

src/marksy/ast.pooka:73
title: String
INFERREDString
constructor

new

src/marksy/ast.pooka:73
INFERREDfn(List(marksy/ast.Inline), String, String) -> marksy/ast.Link
class

Image

src/marksy/ast.pooka:75
class Image(description: List(Inline), destination: String, title: String) is Inline
field

description

src/marksy/ast.pooka:75
description: List(Inline)
INFERREDList(marksy/ast.Inline)
field

destination

src/marksy/ast.pooka:75
destination: String
INFERREDString
field

title

src/marksy/ast.pooka:75
title: String
INFERREDString
constructor

new

src/marksy/ast.pooka:75
INFERREDfn(List(marksy/ast.Inline), String, String) -> marksy/ast.Image
class

RawInline

src/marksy/ast.pooka:77
class RawInline(html: String) is Inline
field

html

src/marksy/ast.pooka:77
html: String
INFERREDString
constructor

new

src/marksy/ast.pooka:77
INFERREDfn(String) -> marksy/ast.RawInline
enum

Alignment

src/marksy/ast.pooka:80
enum Alignment

Column alignment is semantic, not CSS supplied by the source document.

variant

Default

src/marksy/ast.pooka:81
Alignment.Default
variant

Left

src/marksy/ast.pooka:82
Alignment.Left
variant

Center

src/marksy/ast.pooka:83
Alignment.Center
variant

Right

src/marksy/ast.pooka:84
Alignment.Right
class

Table

src/marksy/ast.pooka:87
class Table(
  alignments: List(Alignment),
  header: List(List(Inline)),
  rows: List(List(List(Inline))),
  span: Span
) is Block
field

alignments

src/marksy/ast.pooka:88
alignments: List(Alignment)
INFERREDList(marksy/ast.Alignment)
field

header

src/marksy/ast.pooka:89
header: List(List(Inline))
INFERREDList(List(marksy/ast.Inline))
field

rows

src/marksy/ast.pooka:90
rows: List(List(List(Inline)))
INFERREDList(List(List(marksy/ast.Inline)))
field

span

src/marksy/ast.pooka:91
span: Span
constructor

new

src/marksy/ast.pooka:88
INFERREDfn(List(marksy/ast.Alignment), List(List(marksy/ast.Inline)), List(List(List(marksy/ast.Inline))), marksy/ast.Span) -> marksy/ast.Table
class

Strikethrough

src/marksy/ast.pooka:94
class Strikethrough(content: List(Inline)) is Inline
field

content

src/marksy/ast.pooka:94
content: List(Inline)
INFERREDList(marksy/ast.Inline)
constructor

new

src/marksy/ast.pooka:94