parser

package
v1.0.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 3 Imported by: 0

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 ExtractTags

func ExtractTags(text string, frontmatter string) []string

ExtractTags finds #tags in the text.

func Slugify

func Slugify(name string) string

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 StripFrontmatter

func StripFrontmatter(content string) string

StripFrontmatter removes YAML frontmatter (between --- delimiters) from the start of content.

func TitleFromPath

func TitleFromPath(path string) string

TitleFromPath derives a fallback title from the relative file path.

Types

type Chunk

type Chunk struct {
	Index int
	Text  string
}

Chunk represents a piece of chunked text with its sequential index.

func ChunkText

func ChunkText(text string, chunkSize, overlap int) []Chunk

ChunkText splits text into word-based chunks of approximately chunkSize words with overlap words of overlap between consecutive chunks.

type Link struct {
	Target      string
	DisplayText string
}

Link represents an extracted Obsidian wikilink.

func ExtractLinks(text string) []Link

ExtractLinks finds all Obsidian wikilinks [[Target|Display Text]] in the text. It deduplicates links to the same target to prevent graph edge conflicts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL