markdown

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: MIT Imports: 18 Imported by: 227

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MarkupName describes markup's name
	MarkupName = "markdown"
)

Functions

func IsMarkdownFile

func IsMarkdownFile(name string) bool

IsMarkdownFile reports whether name looks like a Markdown file based on its extension.

func NewGiteaParseContext added in v1.11.0

func NewGiteaParseContext(urlPrefix string, isWiki bool) parser.Context

NewGiteaParseContext creates a parser.Context with the gitea context set

func NewTaskCheckBoxHTMLRenderer added in v1.11.0

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

NewTaskCheckBoxHTMLRenderer creates a TaskCheckBoxHTMLRenderer to render tasklists in the gitea form.

func Render

func Render(rawBytes []byte, urlPrefix string, metas map[string]string) []byte

Render renders Markdown to HTML with all specific handling stuff.

func RenderRaw

func RenderRaw(body []byte, urlPrefix string, wikiMarkdown bool) []byte

RenderRaw renders Markdown to HTML without handling special links.

func RenderString

func RenderString(raw, urlPrefix string, metas map[string]string) string

RenderString renders Markdown to HTML with special links and returns string type.

func RenderWiki

func RenderWiki(rawBytes []byte, urlPrefix string, metas map[string]string) string

RenderWiki renders markdown wiki page to HTML and return HTML string

Types

type GiteaASTTransformer added in v1.11.0

type GiteaASTTransformer struct{}

GiteaASTTransformer is a default transformer of the goldmark tree.

func (*GiteaASTTransformer) Transform added in v1.11.0

func (g *GiteaASTTransformer) Transform(node *ast.Document, reader text.Reader, pc parser.Context)

Transform transforms the given AST tree.

type Parser

type Parser struct{}

Parser implements markup.Parser

func (Parser) Extensions

func (Parser) Extensions() []string

Extensions implements markup.Parser

func (Parser) Name

func (Parser) Name() string

Name implements markup.Parser

func (Parser) Render

func (Parser) Render(rawBytes []byte, urlPrefix string, metas map[string]string, isWiki bool) []byte

Render implements markup.Parser

type TaskCheckBoxHTMLRenderer added in v1.11.0

type TaskCheckBoxHTMLRenderer struct {
	html.Config
}

TaskCheckBoxHTMLRenderer is a renderer.NodeRenderer implementation that renders checkboxes in list items. Overrides the default goldmark one to present the gitea format

func (*TaskCheckBoxHTMLRenderer) RegisterFuncs added in v1.11.0

RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.

Jump to

Keyboard shortcuts

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