renderer

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReadFile = errors.New("file reading error")
	ErrTpl      = errors.New("template error")
)

Functions

This section is empty.

Types

type Options

type Options struct {
	html.RendererOptions

	SyntaxDefaultLang string
	SyntaxTheme       string
}

type Page

type Page struct {
	Title string
	Body  template.HTML

	*config.Template
}

type Renderer

type Renderer struct {
	*html.Renderer
	// contains filtered or unexported fields
}

func NewDefaultRenderer

func NewDefaultRenderer(cfg *config.Markdown, logger *logrus.Logger) (*Renderer, error)

func NewRenderer

func NewRenderer(opts Options, logger *logrus.Logger) (*Renderer, error)

func (*Renderer) Code

func (r *Renderer) Code(w io.Writer, code *ast.Code)

func (*Renderer) CodeBlock

func (r *Renderer) CodeBlock(w io.Writer, codeBlock *ast.CodeBlock)

func (*Renderer) Image

func (r *Renderer) Image(w io.Writer, node *ast.Image, entering bool)

Image renders img tag without trailing slash to match w3c recommendation

func (r *Renderer) Link(w io.Writer, link *ast.Link, entering bool)

Link turns all ".md" extensions to ".html" in links

func (*Renderer) RenderNode

func (r *Renderer) RenderNode(w io.Writer, node ast.Node, entering bool) ast.WalkStatus

RenderNode process images, links, and code blocks differently than default renderer

func (*Renderer) RenderPage

func (r *Renderer) RenderPage(mdFilename string, tplConfig *config.Template) ([]byte, error)

Jump to

Keyboard shortcuts

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