render

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package render implements the server-side Markdown rendering pipeline: goldmark parse -> chroma highlight -> alerts -> heading IDs/TOC -> mermaid -> bluemonday sanitize. See spec §6.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Renderer

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

Renderer renders Markdown to sanitized HTML.

func New

func New() *Renderer

New constructs a Renderer with the mdv goldmark configuration (spec §6.1).

func (*Renderer) Render

func (r *Renderer) Render(source []byte) (*Result, error)

Render parses and renders the given Markdown source.

type Result

type Result struct {
	HTML       string     `json:"html"`
	Title      string     `json:"title"`
	TOC        []TOCEntry `json:"toc"`
	HasMermaid bool       `json:"hasMermaid"`
}

Result is the output of a render pass.

type TOCEntry

type TOCEntry struct {
	Level int    `json:"level"`
	ID    string `json:"id"`
	Text  string `json:"text"`
}

TOCEntry is a single entry in the table of contents.

Jump to

Keyboard shortcuts

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