Documentation
¶
Overview ¶
Package document turns a file's bytes into a Document: raw content, fence-aware source lines, and a parsed frontmatter/data map. It is the format-agnostic substrate every rule reads from.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
Path string
Format Format
Raw []byte
Lines []Line
Frontmatter map[string]any // markdown: parsed frontmatter; data: whole file
Body []byte // markdown content after frontmatter (nil for data)
BodyOffset int // byte offset in Raw where Body begins (0 for data)
}
Document is the parsed view of a single file.
type Format ¶
type Format string
Format identifies how a file is parsed and which rules apply to it.
type Line ¶
type Line struct {
Num int // 1-based line number
Text string // line content without the trailing newline
Start int // byte offset of the line start in Document.Raw
End int // byte offset just past Text (before the newline)
InFence bool // true when the line is INSIDE a fenced code block
}
Line is one source line with byte offsets and fenced-code-block state.
func SplitLines ¶
SplitLines splits raw into fence-aware Lines. A fence delimiter line toggles the in-fence state but is itself reported with InFence=false; only the lines strictly between an opening and closing delimiter are InFence=true.
Click to show internal directories.
Click to hide internal directories.