Documentation
¶
Index ¶
- Variables
- func FormatMarkdown(node ast.Node) []byte
- func Json(input any) string
- func MarkdownTree(initialDepth int, input any) string
- func ParseMarkdown(md []byte) ast.Node
- func RegisterMarkdownHelpers()
- func RenderToNode(ctx *RenderContext, r any) ast.Node
- func RenderWithContext(ctx *RenderContext, r any) string
- type CodeBlock
- type RenderContext
- type Renderable
- type RenderableFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTemplateHelpers = map[string]any{ "json": Json, "markdownTree": MarkdownTree, "renderMarkdown": func(level int, input any) string { return RenderWithContext(&RenderContext{HeadingLevel: level}, input) }, }
Functions ¶
func FormatMarkdown ¶
func MarkdownTree ¶
func ParseMarkdown ¶
func RegisterMarkdownHelpers ¶
func RegisterMarkdownHelpers()
func RenderToNode ¶
func RenderToNode(ctx *RenderContext, r any) ast.Node
func RenderWithContext ¶
func RenderWithContext(ctx *RenderContext, r any) string
Types ¶
type CodeBlock ¶
type CodeBlock struct { Filename string `json:"filename" jsonschema:"title=Filename,description=Filename of the code block."` Language string `json:"language" jsonschema:"title=Language,description=Language of the code block."` Code string `json:"code" jsonschema:"title=Code,description=Code of the code block."` }
CodeBlock represents a block of code with its language and code content.
func ExtractCodeBlocks ¶
ExtractCodeBlocks traverses the given AST and extracts all code blocks. It returns a slice of CodeBlock objects, each representing a code block with its language and code content.
type RenderContext ¶
type RenderContext struct {
HeadingLevel int
}
func (*RenderContext) SpawnHeading ¶
func (ctx *RenderContext) SpawnHeading(title string) *ast.Heading
type Renderable ¶
type Renderable interface {
Render(ctx *RenderContext) ast.Node
}
type RenderableFunc ¶
Click to show internal directories.
Click to hide internal directories.