Documentation ¶
Index ¶
- func DefaultPreamble() []byte
- type Option
- func WithHeadingLevelOffset(offset int) Option
- func WithMakeTitle(value bool) Option
- func WithNoHeadingNumbering(nonumbering bool) Option
- func WithPreamble(preamble []byte) Option
- func WithPreambleFile(path string) Option
- func WithRenderUnsafeElements(unsafe bool) Option
- func WithUnicodeCharactersMapping(mapping func(rune) (raw string, isReplaced bool)) Option
- type Renderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPreamble ¶
func DefaultPreamble() []byte
DefaultPreamble returns a copy of the default preamble provided by goldmark-latex. It does not include \begin{document} text within, as expected by Config.Preamble.
Types ¶
type Option ¶
type Option func(*Renderer)
Option is the type for functional options.
func WithHeadingLevelOffset ¶
func WithMakeTitle ¶
func WithNoHeadingNumbering ¶
func WithPreamble ¶
func WithPreambleFile ¶
type Renderer ¶
type Renderer struct { // Increase heading levels: if the offset is 1, \section (1) becomes \subsection (2) etc. // Negative offset is also valid. // Resulting levels are clipped between 1 and 6. HeadingLevelOffset int // Removes section numbering. NoHeadingNumbering bool // Replace the default preamble by setting this to a non-nil byte slice. // Should NOT end with \begin{document}, this is added automatically. Preamble []byte // If set renderer will render possibly unsafe elements, such as links and // code block raw content. Unsafe bool // Declares all used unicode characters in the preamble // and replaces them with the result of this function. DeclareUnicode func(rune) (raw string, isReplaced bool) // contains filtered or unexported fields }
Renderer is a LaTeX renderer implementation for extending goldmark to generate .tex files.
func NewRenderer ¶
NewRenderer returns a new Renderer with given options. Options are applied in order of appearance. Example:
lr := latex.NewRenderer( latex.WithRenderUNsafeElements(true), // ... add more desired configuration options ) r := renderer.NewRenderer(renderer.WithNodeRenderers(util.Prioritized(lr, 1000))) md := goldmark.New(goldmark.WithRenderer(r)) md.Convert(markdown, LaTeXoutput)
func (*Renderer) RegisterFuncs ¶
func (r *Renderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements goldmark's renderer.NodeRenderer interface.
Click to show internal directories.
Click to hide internal directories.