md2docx

package module
v0.0.0-...-89d51d1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 8 Imported by: 0

README

Caveats

  1. List items cannot contain new paragraphs. In Docx, the formatting for a list item is a paragraph style and you cannot have paragraphs inside paragraphs. Line breaks will need to be used instead.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocxRenderer

type DocxRenderer struct {
	DocxRendererParameters
	// contains filtered or unexported fields
}

DocxRenderer is a type that implements the Renderer interface for docx output.

Do not create this directly, instead use the NewDocxRenderer function.

func NewDocxRenderer

func NewDocxRenderer(doc *document.Document, params DocxRendererParameters) *DocxRenderer

NewDocxRenderer creates and configures a DocxRenderer object, which satisfies the Renderer interface.

func (*DocxRenderer) RenderFooter

func (r *DocxRenderer) RenderFooter(w io.Writer, ast *bf.Node)

RenderFooter writes document footer.

func (*DocxRenderer) RenderHeader

func (r *DocxRenderer) RenderHeader(w io.Writer, ast *bf.Node)

RenderHeader writes document preamble and TOC if requested.

func (*DocxRenderer) RenderNode

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

RenderNode is a default renderer of a single node of a syntax tree. For block nodes it will be called twice: first time with entering=true, second time with entering=false, so that it could know when it's working on an open tag and when on close. It writes the result to w.

The return value is a way to tell the calling walker to adjust its walk pattern: e.g. it can terminate the traversal by returning Terminate. Or it can ask the walker to skip a subtree of this node by returning SkipChildren. The typical behavior is to return GoToNext, which asks for the usual traversal to the next node.

type DocxRendererParameters

type DocxRendererParameters struct {
	StyleHyperlink     string
	StyleListOrdered   string
	StyleListUnordered string
	StyleHeading1      string
	StyleHeading2      string
	StyleHeading3      string
	StyleHeading4      string
	StyleHeading5      string
	StyleCodeBlock     string
	StyleCodeInline    string
	StyleBlockQuote    string
	StyleTable         string // This is a table specific style
}

DocxRendererParameters configuration object that gets passed to NewDocxRenderer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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