content

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package content renders Markdown at build time: CommonMark plus the GFM extensions, stable heading ids and anchor links, and the GFM disallowed raw HTML filter (REQ-CNT-01). Only repository files are rendered (SI-12).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeCSS

func CodeCSS() string

CodeCSS returns the light and dark stylesheet of the highlighted code blocks (REQ-CNT-04).

func Render

func Render(src []byte, opts Options) ([]byte, error)

Render renders Markdown to HTML.

func RenderCode

func RenderCode(lang, info, code string) string

RenderCode renders one highlighted code block (REQ-CNT-04).

Types

type CodeOptions

type CodeOptions = highlight.Options

CodeOptions are the per-block options of a highlighted code block (REQ-CNT-04).

func ParseCodeInfo

func ParseCodeInfo(lang, info string) CodeOptions

ParseCodeInfo parses the fence info string (REQ-CNT-04).

type Heading

type Heading struct {
	Level int
	Text  string
	ID    string
}

Heading is one heading of a Markdown page (REQ-CNT-06).

func Headings

func Headings(src []byte) []Heading

Headings returns the headings of src with the ids the renderer gives them (REQ-CNT-06).

type Options

type Options struct {
	// GFM enables tables, task lists, strikethrough and autolinks, and the
	// GFM disallowed raw HTML filter (REQ-CNT-01).
	GFM bool
	// Footnotes enables the footnote extension (REQ-CNT-01).
	Footnotes bool
	// Anchors adds a stable id and an anchor link to every heading
	// (REQ-CNT-01).
	Anchors bool
	// XHTML renders void elements in the XHTML form the CommonMark spec
	// uses (<hr />). Content pages use the HTML5 form.
	XHTML bool
	// Highlight renders fenced code blocks as highlighted frames
	// (REQ-CNT-04).
	Highlight bool
}

Options configure one render.

Jump to

Keyboard shortcuts

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