Packages
Search packages... ⌘K
Go Package
document
Structured document model — markdown rendering, frontmatter, content blocks
Go Ready MD
Document Parsing go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
doc, err := document.Parse(file)
// Access typed frontmatter
title := doc.Frontmatter.Get("title") // "Architecture Overview"
tags := doc.Frontmatter.GetSlice("tags") // ["architecture", "design"]
// Iterate content blocks
for _, block := range doc.Blocks {
switch block.Type {
case document.HeadingBlock:
fmt.Printf("H%d: %s\n", block.Level, block.Text)
case document.CodeBlock:
fmt.Printf("Code (%s): %d lines\n", block.Language, block.LineCount)
}
}
// Render to HTML
html, err := doc.Render()About
Parses structured documents with YAML frontmatter and markdown body into typed content blocks. Supports rendering to HTML, extracting headings for table-of-contents generation, and block-level content manipulation.
Public API
| Name | Kind | Signature |
|---|---|---|
| Document | type | type Document struct |
| Parse | func | func Parse(r io.Reader) (*Document, error) |
| Render | func | func (d *Document) Render() (string, error) |
| Block | type | type Block struct |
| Frontmatter | type | type Frontmatter struct |
Source
github.com/shredbx/sbx-core/pkg/document
markdownfrontmattercontent-blocksrendering