markdownAnnotate

package
v0.0.0-...-3319032 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DocGoKind = gast.NewNodeKind("gc")

DocGoKind is a `NodeKind` that needs to be registered to the goldmark parser, so that it can be properly marked and each AST walker can know the type of this node.

View Source
var DocgoExtension = &gcExtender{}

TaskList is an extension that allow you to use GFM task lists.

Functions

func CleanPage

func CleanPage(page string) string

CleanPage takes a Markdown source as an input and deletes AST nodes that wouldn't be useful for searching/metadata purposes.

func NewDocgoParser

func NewDocgoParser() parser.InlineParser

func NewDocgoRenderer

func NewDocgoRenderer(opts ...html.Option) renderer.NodeRenderer

NewDocgoRenderer returns a `NodeRenderer` instance capable of rendering Markdown for code documentation pages, containing annotations.

func RenderPage

func RenderPage(markdownString string) string

Renders a markdown source with GitHub flavor into HTML

func SplitPages

func SplitPages(markdownOutputBytes []byte) ([]string, []string)

Splits a single Markdown source string into N strings that represent Markdown sections. The sections are defined using Markdown annotations.

Types

type DocGoNode

type DocGoNode struct {
	gast.BaseInline
	Code         string
	Attrs        map[string]bool
	StringVars   map[string]string
	IntVars      map[string]int
	BoolVars     map[string]bool
	LineStart    int
	LineEnd      int
	DecodeStatus string
}

DocGoNode represents an AST node in the Markdown hierarchy. It contains annotations (that have attributes and begin/end marks) used later for rendering purposes.

func (*DocGoNode) Dump

func (n *DocGoNode) Dump(source []byte, level int)

Dump makes the DocGoNode conform to AST interface

func (*DocGoNode) Kind

func (n *DocGoNode) Kind() gast.NodeKind

Kind makes sure DocGoNode reports its correct ID/Kind to other AST processors

func (*DocGoNode) String

func (n *DocGoNode) String() string

type DocgoRenderer

type DocgoRenderer struct {
	html.Config
}

`DocgoRenderer` is an inline renderer that fetches the AST nodes containing docgo annotation and converts them to the appropriate HTML.

func (*DocgoRenderer) RegisterFuncs

func (r *DocgoRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)

RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.

Jump to

Keyboard shortcuts

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