CJK is a goldmark extension that provides functionalities for CJK languages.
var CJK = NewCJK(WithEastAsianLineBreaks(), WithEscapedSpace())
DefinitionDescriptionAttributeFilter defines attribute names which dd elements can have.
var DefinitionDescriptionAttributeFilter = html.GlobalAttributeFilter
DefinitionList is an extension that allow you to use PHP Markdown Extra Definition lists.
var DefinitionList = &definitionList{}
DefinitionListAttributeFilter defines attribute names which dl elements can have.
var DefinitionListAttributeFilter = html.GlobalAttributeFilter
DefinitionTermAttributeFilter defines attribute names which dd elements can have.
var DefinitionTermAttributeFilter = html.GlobalAttributeFilter
Footnote is an extension that allow you to use PHP Markdown Extra Footnotes.
var Footnote = &footnote{ options: []FootnoteOption{}, }
GFM is an extension that provides Github Flavored markdown functionalities.
var GFM = &gfm{}
Linkify is an extension that allow you to parse text that seems like a URL.
var Linkify = &linkify{}
Strikethrough is an extension that allow you to use strikethrough expression like '~~text~~' .
var Strikethrough = &strikethrough{}
StrikethroughAttributeFilter defines attribute names which dd elements can have.
var StrikethroughAttributeFilter = html.GlobalAttributeFilter
Table is an extension that allow you to use GFM tables .
var Table = &table{ options: []TableOption{}, }
TableAttributeFilter defines attribute names which table elements can have.
var TableAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("align"), []byte("bgcolor"), []byte("border"), []byte("cellpadding"), []byte("cellspacing"), []byte("frame"), []byte("rules"), []byte("summary"), []byte("width"), )
TableHeaderAttributeFilter defines attribute names which <thead> elements can have.
var TableHeaderAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("align"), []byte("bgcolor"), []byte("char"), []byte("charoff"), []byte("valign"), )
TableRowAttributeFilter defines attribute names which <tr> elements can have.
var TableRowAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("align"), []byte("bgcolor"), []byte("char"), []byte("charoff"), []byte("valign"), )
TableTdCellAttributeFilter defines attribute names which table <td> cells can have.
var TableTdCellAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("abbr"), []byte("align"), []byte("axis"), []byte("bgcolor"), []byte("char"), []byte("charoff"), []byte("colspan"), []byte("headers"), []byte("height"), []byte("rowspan"), []byte("scope"), []byte("valign"), []byte("width"), )
TableThCellAttributeFilter defines attribute names which table <th> cells can have.
var TableThCellAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("abbr"), []byte("align"), []byte("axis"), []byte("bgcolor"), []byte("char"), []byte("charoff"), []byte("colspan"), []byte("headers"), []byte("height"), []byte("rowspan"), []byte("scope"), []byte("valign"), []byte("width"), )
TaskList is an extension that allow you to use GFM task lists.
var TaskList = &taskList{}
Typographer is an extension that replaces punctuations with typographic entities.
var Typographer = &typographer{}
func NewCJK(opts ...CJKOption) goldmark.Extender
NewCJK returns a new extension with given options.
func NewDefinitionDescriptionParser() parser.BlockParser
NewDefinitionDescriptionParser return a new parser.BlockParser that can parse definition description starts with ':'.
func NewDefinitionListHTMLRenderer(opts ...html.Option) renderer.NodeRenderer
NewDefinitionListHTMLRenderer returns a new DefinitionListHTMLRenderer.
func NewDefinitionListParser() parser.BlockParser
NewDefinitionListParser return a new parser.BlockParser that can parse PHP Markdown Extra Definition lists.
func NewFootnote(opts ...FootnoteOption) goldmark.Extender
NewFootnote returns a new extension with given options.
func NewFootnoteASTTransformer() parser.ASTTransformer
NewFootnoteASTTransformer returns a new parser.ASTTransformer that insert a footnote list to the last of the document.
func NewFootnoteBlockParser() parser.BlockParser
NewFootnoteBlockParser returns a new parser.BlockParser that can parse footnotes of the Markdown(PHP Markdown Extra) text.
func NewFootnoteHTMLRenderer(opts ...FootnoteOption) renderer.NodeRenderer
NewFootnoteHTMLRenderer returns a new FootnoteHTMLRenderer.
func NewFootnoteParser() parser.InlineParser
NewFootnoteParser returns a new parser.InlineParser that can parse footnote links of the Markdown(PHP Markdown Extra) text.
func NewLinkify(opts ...LinkifyOption) goldmark.Extender
NewLinkify creates a new goldmark.Extender that allow you to parse text that seems like a URL.
func NewLinkifyParser(opts ...LinkifyOption) parser.InlineParser
NewLinkifyParser return a new InlineParser can parse text that seems like a URL.
func NewStrikethroughHTMLRenderer(opts ...html.Option) renderer.NodeRenderer
NewStrikethroughHTMLRenderer returns a new StrikethroughHTMLRenderer.
func NewStrikethroughParser() parser.InlineParser
NewStrikethroughParser return a new InlineParser that parses strikethrough expressions.
func NewTable(opts ...TableOption) goldmark.Extender
NewTable returns a new extension with given options.
func NewTableASTTransformer() parser.ASTTransformer
NewTableASTTransformer returns a parser.ASTTransformer for tables.
func NewTableHTMLRenderer(opts ...TableOption) renderer.NodeRenderer
NewTableHTMLRenderer returns a new TableHTMLRenderer.
func NewTableParagraphTransformer() parser.ParagraphTransformer
NewTableParagraphTransformer returns a new ParagraphTransformer that can transform paragraphs into tables.
func NewTaskCheckBoxHTMLRenderer(opts ...html.Option) renderer.NodeRenderer
NewTaskCheckBoxHTMLRenderer returns a new TaskCheckBoxHTMLRenderer.
func NewTaskCheckBoxParser() parser.InlineParser
NewTaskCheckBoxParser returns a new InlineParser that can parse checkboxes in list items. This parser must take precedence over the parser.LinkParser.
func NewTypographer(opts ...TypographerOption) goldmark.Extender
NewTypographer returns a new Extender that replaces punctuations with typographic entities.
func NewTypographerParser(opts ...TypographerOption) parser.InlineParser
NewTypographerParser return a new InlineParser that parses typographer expressions.
A CJKOption sets options for CJK support mostly for HTML based renderers.
type CJKOption func(*cjk)
func WithEastAsianLineBreaks(style ...EastAsianLineBreaks) CJKOption
WithEastAsianLineBreaks is a functional option that indicates whether softline breaks between east asian wide characters should be ignored. style defauts to EastAsianLineBreaksSimple .
func WithEscapedSpace() CJKOption
WithEscapedSpace is a functional option that indicates that a '\' escaped half-space(0x20) should not be rendered.
DefinitionListHTMLRenderer is a renderer.NodeRenderer implementation that renders DefinitionList nodes.
type DefinitionListHTMLRenderer struct { html.Config }
func (r *DefinitionListHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.
A EastAsianLineBreaks is a style of east asian line breaks.
type EastAsianLineBreaks int
const ( //EastAsianLineBreaksNone renders line breaks as it is. EastAsianLineBreaksNone EastAsianLineBreaks = iota // EastAsianLineBreaksSimple is a style where soft line breaks are ignored // if both sides of the break are east asian wide characters. EastAsianLineBreaksSimple // EastAsianLineBreaksCSS3Draft is a style where soft line breaks are ignored // even if only one side of the break is an east asian wide character. EastAsianLineBreaksCSS3Draft )
FootnoteConfig holds configuration values for the footnote extension.
Link* and Backlink* configurations have some variables: Occurrences of “^^” in the string will be replaced by the corresponding footnote number in the HTML output. Occurrences of “%%” will be replaced by a number for the reference (footnotes can have multiple references).
type FootnoteConfig struct { html.Config // IDPrefix is a prefix for the id attributes generated by footnotes. IDPrefix []byte // IDPrefix is a function that determines the id attribute for given Node. IDPrefixFunction func(gast.Node) []byte // LinkTitle is an optional title attribute for footnote links. LinkTitle []byte // BacklinkTitle is an optional title attribute for footnote backlinks. BacklinkTitle []byte // LinkClass is a class for footnote links. LinkClass []byte // BacklinkClass is a class for footnote backlinks. BacklinkClass []byte // BacklinkHTML is an HTML content for footnote backlinks. BacklinkHTML []byte }
func NewFootnoteConfig() FootnoteConfig
NewFootnoteConfig returns a new Config with defaults.
func (c *FootnoteConfig) SetOption(name renderer.OptionName, value interface{})
SetOption implements renderer.SetOptioner.
FootnoteHTMLRenderer is a renderer.NodeRenderer implementation that renders FootnoteLink nodes.
type FootnoteHTMLRenderer struct { FootnoteConfig }
func (r *FootnoteHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.
FootnoteOption interface is a functional option interface for the extension.
type FootnoteOption interface { renderer.Option // SetFootnoteOption sets given option to the extension. SetFootnoteOption(*FootnoteConfig) }
func WithFootnoteBacklinkClass(a []byte) FootnoteOption
WithFootnoteBacklinkClass is a functional option that is a class for footnote backlinks.
func WithFootnoteBacklinkHTML(a []byte) FootnoteOption
WithFootnoteBacklinkHTML is an HTML content for footnote backlinks.
func WithFootnoteBacklinkTitle(a []byte) FootnoteOption
WithFootnoteBacklinkTitle is a functional option that is an optional title attribute for footnote backlinks.
func WithFootnoteHTMLOptions(opts ...html.Option) FootnoteOption
WithFootnoteHTMLOptions is functional option that wraps goldmark HTMLRenderer options.
func WithFootnoteIDPrefix(a []byte) FootnoteOption
WithFootnoteIDPrefix is a functional option that is a prefix for the id attributes generated by footnotes.
func WithFootnoteIDPrefixFunction(a func(gast.Node) []byte) FootnoteOption
WithFootnoteIDPrefixFunction is a functional option that is a prefix for the id attributes generated by footnotes.
func WithFootnoteLinkClass(a []byte) FootnoteOption
WithFootnoteLinkClass is a functional option that is a class for footnote links.
func WithFootnoteLinkTitle(a []byte) FootnoteOption
WithFootnoteLinkTitle is a functional option that is an optional title attribute for footnote links.
An LinkifyConfig struct is a data structure that holds configuration of the Linkify extension.
type LinkifyConfig struct { AllowedProtocols [][]byte URLRegexp *regexp.Regexp WWWRegexp *regexp.Regexp EmailRegexp *regexp.Regexp }
func (c *LinkifyConfig) SetOption(name parser.OptionName, value interface{})
SetOption implements SetOptioner.
A LinkifyOption interface sets options for the LinkifyOption.
type LinkifyOption interface { parser.Option SetLinkifyOption(*LinkifyConfig) }
func WithLinkifyAllowedProtocols(value [][]byte) LinkifyOption
WithLinkifyAllowedProtocols is a functional option that specify allowed protocols in autolinks. Each protocol must end with ':' like 'http:' .
func WithLinkifyEmailRegexp(value *regexp.Regexp) LinkifyOption
WithLinkifyEmailRegexp is a functional otpion that specify a pattern of the email address.
func WithLinkifyURLRegexp(value *regexp.Regexp) LinkifyOption
WithLinkifyURLRegexp is a functional option that specify a pattern of the URL including a protocol.
func WithLinkifyWWWRegexp(value *regexp.Regexp) LinkifyOption
WithLinkifyWWWRegexp is a functional option that specify a pattern of the URL without a protocol. This pattern must start with 'www.' .
StrikethroughHTMLRenderer is a renderer.NodeRenderer implementation that renders Strikethrough nodes.
type StrikethroughHTMLRenderer struct { html.Config }
func (r *StrikethroughHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.
TableCellAlignMethod indicates how are table cells aligned in HTML format.
type TableCellAlignMethod int
const ( // TableCellAlignDefault renders alignments by default method. // With XHTML, alignments are rendered as an align attribute. // With HTML5, alignments are rendered as a style attribute. TableCellAlignDefault TableCellAlignMethod = iota // TableCellAlignAttribute renders alignments as an align attribute. TableCellAlignAttribute // TableCellAlignStyle renders alignments as a style attribute. TableCellAlignStyle // TableCellAlignNone does not care about alignments. // If you using classes or other styles, you can add these attributes // in an ASTTransformer. TableCellAlignNone )
TableConfig struct holds options for the extension.
type TableConfig struct { html.Config // TableCellAlignMethod indicates how are table celss aligned. TableCellAlignMethod TableCellAlignMethod }
func NewTableConfig() TableConfig
NewTableConfig returns a new Config with defaults.
func (c *TableConfig) SetOption(name renderer.OptionName, value interface{})
SetOption implements renderer.SetOptioner.
TableHTMLRenderer is a renderer.NodeRenderer implementation that renders Table nodes.
type TableHTMLRenderer struct { TableConfig }
func (r *TableHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.
TableOption interface is a functional option interface for the extension.
type TableOption interface { renderer.Option // SetTableOption sets given option to the extension. SetTableOption(*TableConfig) }
func WithTableCellAlignMethod(a TableCellAlignMethod) TableOption
WithTableCellAlignMethod is a functional option that indicates how are table cells aligned in HTML format.
func WithTableHTMLOptions(opts ...html.Option) TableOption
WithTableHTMLOptions is functional option that wraps goldmark HTMLRenderer options.
TaskCheckBoxHTMLRenderer is a renderer.NodeRenderer implementation that renders checkboxes in list items.
type TaskCheckBoxHTMLRenderer struct { html.Config }
func (r *TaskCheckBoxHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.
An TypographerConfig struct is a data structure that holds configuration of the Typographer extension.
type TypographerConfig struct { Substitutions [][]byte }
func (b *TypographerConfig) SetOption(name parser.OptionName, value interface{})
SetOption implements SetOptioner.
A TypographerOption interface sets options for the TypographerParser.
type TypographerOption interface { parser.Option SetTypographerOption(*TypographerConfig) }
func WithTypographicSubstitutions(values map[TypographicPunctuation][]byte) TypographerOption
WithTypographicSubstitutions is a functional otpion that specify replacement text for punctuations.
TypographicPunctuation is a key of the punctuations that can be replaced with typographic entities.
type TypographicPunctuation int
const ( // LeftSingleQuote is ' . LeftSingleQuote TypographicPunctuation = iota + 1 // RightSingleQuote is ' . RightSingleQuote // LeftDoubleQuote is " . LeftDoubleQuote // RightDoubleQuote is " . RightDoubleQuote // EnDash is -- . EnDash // EmDash is --- . EmDash // Ellipsis is ... . Ellipsis // LeftAngleQuote is << . LeftAngleQuote // RightAngleQuote is >> . RightAngleQuote // Apostrophe is ' . Apostrophe )
TypographicSubstitutions is a list of the substitutions for the Typographer extension.
type TypographicSubstitutions map[TypographicPunctuation][]byte