markdown

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package markdown provides a smart markdown chunker using scored break points. Chunks are delimited by headings, code fences, horizontal rules, and blank lines. Each candidate break point is scored by its semantic weight and by how close it falls to an ideal chunk boundary (a multiple of targetSize lines), so that chunks stay roughly uniform in length.

Index

Constants

View Source
const ChunkTypeSection chunking.ChunkType = "section"

ChunkTypeSection represents a heading-delimited markdown section.

View Source
const LanguageMarkdown chunking.Language = "markdown"

LanguageMarkdown is the Language constant for Markdown files.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunker

type Chunker struct {
	// contains filtered or unexported fields
}

Chunker implements chunking.Chunker for Markdown files.

func NewChunker

func NewChunker(options chunking.ChunkOptions) *Chunker

NewChunker creates a new Markdown chunker with the given options.

func (*Chunker) Chunk

func (c *Chunker) Chunk(ctx context.Context, filePath string) ([]chunking.Chunk, error)

Chunk reads a markdown file from disk and returns semantic chunks.

func (*Chunker) ChunkContent

func (c *Chunker) ChunkContent(ctx context.Context, filePath, content string) ([]chunking.Chunk, error)

ChunkContent chunks markdown content supplied as a string. This is useful for content-addressable storage where the raw bytes are already available without a round-trip through the filesystem.

func (*Chunker) Language

func (c *Chunker) Language() chunking.Language

Language returns the language this chunker supports.

func (*Chunker) SupportedExtensions

func (c *Chunker) SupportedExtensions() []string

SupportedExtensions returns file extensions handled by this chunker.

Jump to

Keyboard shortcuts

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