Documentation
¶
Index ¶
Constants ¶
const DocumentVersion = 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
Version int `json:"version"`
Filename string `json:"filename,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Root Node `json:"root"`
}
Document is a parsed markdown document that can render through Clicky's Textable formats and export as structured Clicky document JSON.
func ParseString ¶
ParseString parses markdown source into a structured Clicky markdown document.
func (*Document) ClickyDocument ¶
func (d *Document) ClickyDocument() formatters.ClickyDocument
ClickyDocument exports the parsed tree using the same JSON envelope consumed by @flanksource/clicky-ui.
type Node ¶
type Node struct {
Kind string `json:"kind"`
Text string `json:"text,omitempty"`
Children []Node `json:"children,omitempty"`
Items []Node `json:"items,omitempty"`
Attributes map[string]string `json:"attributes,omitempty"`
Level int `json:"level,omitempty"`
Language string `json:"language,omitempty"`
Source string `json:"source,omitempty"`
RawHTML string `json:"html,omitempty"`
Href string `json:"href,omitempty"`
Title string `json:"title,omitempty"`
ID string `json:"id,omitempty"`
Severity string `json:"severity,omitempty"`
Checked *bool `json:"checked,omitempty"`
Ordered bool `json:"ordered,omitempty"`
Align string `json:"align,omitempty"`
LineStart int `json:"lineStart,omitempty"`
LineEnd int `json:"lineEnd,omitempty"`
}
Node is the intermediate semantic tree produced from Goldmark's AST.
func (Node) ClickyNode ¶
func (n Node) ClickyNode() formatters.ClickyNode
ClickyNode converts the markdown node to Clicky's concrete document JSON node.
type Option ¶
type Option func(*Options)
Option configures markdown parsing.
func WithAdmonitions ¶
WithAdmonitions enables or disables pragmatic "!!! severity title" parsing.
func WithFilename ¶
WithFilename records the source filename in the parsed document metadata.
func WithFootnotes ¶
WithFootnotes enables or disables footnote parsing.
func WithFrontmatter ¶
WithFrontmatter enables or disables leading YAML frontmatter extraction.
func WithPreserveHTML ¶
WithPreserveHTML controls whether raw HTML nodes are retained.
func WithSourceSpans ¶
WithSourceSpans controls whether line start/end metadata is attached to nodes.