parser

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(ext string, p Parser)

Register associates an extension (e.g. ".md") with a Parser.

Types

type Document

type Document struct {
	Title    string
	Sections []Section
}

Document is the parsed output of a file.

type Parser

type Parser interface {
	Parse(path string, data []byte) (*Document, error)
}

Parser extracts structure from a file's bytes.

func For

func For(ext string) Parser

For returns the Parser for the given extension, or plaintext fallback.

type Section

type Section struct {
	HeadingPath string // e.g. "Introduction > Background"
	Text        string
	Ordinal     int // byte offset where this section starts
}

Section is a logical division of a document (heading + content).

Jump to

Keyboard shortcuts

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