Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Parser = goldmark.New( goldmark.WithExtensions( extension.Table, extension.Strikethrough, extension.Footnote, &frontmatter.Extender{}, figure.Figure, Typographer, ), goldmark.WithParserOptions( parser.WithAutoHeadingID(), ), goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), )
var Typographer = &typographer{}
Typographer is an extension that replaces punctuations with typographic entities.
Functions ¶
func NewTypographer ¶
func NewTypographer(opts ...TypographerOption) goldmark.Extender
NewTypographer returns a new Extender that replaces punctuations with typographic entities.
func NewTypographerParser ¶
func NewTypographerParser(opts ...TypographerOption) parser.InlineParser
NewTypographerParser return a new InlineParser that parses typographer expressions.
Types ¶
type TypographerConfig ¶
type TypographerConfig struct {
Substitutions [][]byte
}
An TypographerConfig struct is a data structure that holds configuration of the Typographer extension.
func (*TypographerConfig) SetOption ¶
func (b *TypographerConfig) SetOption(name parser.OptionName, value interface{})
SetOption implements SetOptioner.
type TypographerOption ¶
type TypographerOption interface { parser.Option SetTypographerOption(*TypographerConfig) }
A TypographerOption interface sets options for the TypographerParser.
func WithTypographicSubstitutions ¶
func WithTypographicSubstitutions[T []byte | string](values map[TypographicPunctuation]T) TypographerOption
WithTypographicSubstitutions is a functional otpion that specify replacement text for punctuations.
type TypographicPunctuation ¶
type TypographicPunctuation int
TypographicPunctuation is a key of the punctuations that can be replaced with typographic entities.
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 )
type TypographicSubstitutions ¶
type TypographicSubstitutions map[TypographicPunctuation][]byte
TypographicSubstitutions is a list of the substitutions for the Typographer extension.