Documentation
¶
Index ¶
- func NewTagASTTransformer() parser.ASTTransformer
- func NewWikilinkInlineParser() parser.InlineParser
- func NormalizeAliasKey(s string) string
- func ParseFrontmatterYAML(yamlBytes []byte) (props map[string]string, aliases []string, err error)
- func SplitFrontmatter(src []byte) (yamlBytes []byte, body []byte, ok bool)
- func StableBlockID(sourcePath string, lineStart, lineEnd int) string
- func StripWikilinkBrackets(s string) string
- type Engine
- type HashTag
- type ParseResult
- type TagRef
- type Wikilink
- type WikilinkRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTagASTTransformer ¶
func NewTagASTTransformer() parser.ASTTransformer
NewTagASTTransformer runs after inline parsing and splits plain *ast.Text runs into Text + HashTag fragments for Logseq-style #tags (letters, digits, _, /, -, Unicode letters).
func NewWikilinkInlineParser ¶
func NewWikilinkInlineParser() parser.InlineParser
NewWikilinkInlineParser registers on '[' and wins over the standard Link parser when the lookahead is '[['. Priority should be lower numeric than LinkParser (200), e.g. 150.
func NormalizeAliasKey ¶
NormalizeAliasKey lowercases and strips wikilink brackets for alias lookup.
func ParseFrontmatterYAML ¶
ParseFrontmatterYAML parses YAML frontmatter into flat string properties and extracted aliases. Known alias keys: alias, aliases (string, slice, or nested wikilink strings).
func SplitFrontmatter ¶
SplitFrontmatter returns YAML bytes and markdown body when the file starts with a YAML frontmatter block (--- ... ---). Otherwise ok is false and body is the full src.
func StableBlockID ¶
StableBlockID returns a deterministic UUID (v5-style SHA-1) for a block span in a file. IDs remain stable across re-parses as long as the same source path and line span represent the same block; after edits, line ranges change and IDs update accordingly.
func StripWikilinkBrackets ¶
StripWikilinkBrackets trims optional Obsidian-style [[ ... ]] around a title.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine holds a reusable Goldmark parser configured for Dingovault (wikilinks + #tags).
func NewEngine ¶
func NewEngine() *Engine
NewEngine builds a parser with:
- default block/inline parsers, plus a [[wikilink]] inline parser before LinkParser;
- an AST transformer that splits #tags out of plain text (skipping code spans).
func (*Engine) ParseSource ¶
func (e *Engine) ParseSource(src []byte, sourcePath string) (ParseResult, error)
ParseSource parses UTF-8 Markdown into blocks, wikilinks, and tags. It does not read or write the filesystem.
type HashTag ¶
type HashTag struct {
ast.BaseInline
Name []byte
Segment text.Segment
}
HashTag is an inline AST node for #tags discovered after plain-text tokenization.
func NewHashTag ¶
NewHashTag constructs a tag node; seg covers the full "#name" span in the source.
type ParseResult ¶
type ParseResult struct {
Blocks []domain.Block
Wikilinks []WikilinkRef
Tags []TagRef
}
ParseResult is the output of Markdown parsing for one file.
type Wikilink ¶
type Wikilink struct {
ast.BaseInline
Target []byte
Alias []byte
}
Wikilink is an inline AST node for Logseq-style [[page]] or [[page|alias]].
func NewWikilink ¶
NewWikilink returns a wikilink node with trimmed target and optional display alias.
type WikilinkRef ¶
WikilinkRef records a wikilink emitted by a specific block.