Documentation
¶
Overview ¶
Package parser provides Markdown parsing, slugification, and text chunking for notebrain-cli.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAttachmentLink ¶
IsAttachmentLink returns true if target points to a non-markdown file or attachment (e.g., images, PDFs, canvas files).
func Slugify ¶
Slugify converts a note name/filename to a URL-safe slug. It lowercases, trims .md, replaces spaces with hyphens, and removes non-alphanumeric characters except hyphens.
func TitleFromPath ¶
TitleFromPath derives a fallback title from the relative file path.
Types ¶
type Chunk ¶
type Chunk struct {
NoteSlug string
Index int
Text string // clean prose text for embedding (code blocks replaced with placeholders)
RichText string // full text with actual code inline (for storage/retrieval)
HeadingPath string // e.g. "Architecture > Data Flow > Ingest"
Level int // depth of the deepest heading in this chunk (1-6)
CodeBlocks int // number of fenced code blocks in this chunk
HasTable bool
HasTask bool
WordCount int
}
Chunk is one section of a note, bounded by heading structure.
type Result ¶
Result is the output from parsing the full document, containing the chunks and metadata.
func Parse ¶
Parse parses body text into Chunks, extracting wikilinks, tags, and frontmatter. maxChunkRunes controls the maximum rune length per chunk. overlapRunes controls how many runes are repeated at the start of the next sub-chunk when a section is split (overlap). If skipAttachments is true, links pointing to non-markdown attachments (images, PDFs, etc.) are ignored.