markdown

package
v0.0.0-...-efe9689 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

Jump to

Keyboard shortcuts

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