typographer

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: MIT Imports: 3 Imported by: 0

README

Goldmark Typographer Language Extension

Go Reference

Package typographer allows you to select the language typographic substitutions for Goldmark Typographer.

This library is not a replacement of the standard Goldmark typography, and only expands its capabilities by adding quotation symbols for different languages.

import typographer "github.com/mdigger/goldmark-lang-typographer"

markdown := goldmark.New(
    goldmark.WithExtensions(
        typographer.New("ru"),
    ),
)

Quotation marks substitution

Quotes substitutions based on Wikipedia. If the substitutions for this language are not specified, the library tries to use substitutions for the base language or default.

Code Lang Double Single Dash
af Afrikaans
sq Albanian „“
am Amharic «» ‹›
ar Arabic «»
hy Armenian «»
az Azerbaijani «»
eu Basque «»
be Belarusian «» --
bs Bosnian ”” ’’
bg Bulgarian „“ ’’
ca Catalan «»
zh-Hans Chinese, simplified
hr Croatian „”
cs Czech „“ ‚‘
da Danish »« ›‹
nl Dutch
en English
en-GB English, UK
en-US English, US
en-CA English, Canada
eo Esperanto
et Estonian „“
fil Filipino
fi Finnish ”” ’’
fr French « » ‹ ›
fr-CH French, Swiss «» ‹›
gl Galician «»
ka Georgian „“
de German „“ ‚‘
de-CH German, Swiss «» ‹›
el Greek «»
he Hebrew ”” ’’
hi Hindi
hu Hungarian „” ’’
is Icelandic „“ ‚‘
io Ido «»
id Indonesian
ia Interlingua
ga Irish
it Italian «»
it-CH Italian, Swiss «» ‹›
kk Kazakh «»
km Khmer «»
ko Korean, South Korea
lo Lao
lv Latvian
lt Lithuanian „“ ‚‘
mk Macedonian „“ ’‘
mt Maltese
mn-Cyrl Mongolian, Cyrillic script «»
no Norwegian «»
oc Occitan «»
ps Pashto «»
fa Persian «»
pl Polish „”
pt-BR Portuguese, Brazil
pt-PL Portuguese, Portugal «»
ro Romanian „”
rm Romansh «» ‹›
ru Russian «» --
sr Serbian „” ’’
gd Scottish Gaelic
sk Slovak „“ ‚‘
sl Slovene „“ ‚‘
wen Sorbian „“ ‚‘
es Spanish «»
sv Swedish ”” ’’
ta Tamil
ti Tigrinya «» ‹›
th Thai
tr Turkish
uk Ukrainian «» --
ur Urdu
ug Uyghur «» ‹›
uz Uzbek «» ‚‘
vi Vietnamese
cy Welsh

Documentation

Overview

Package typographer allows you to select the language typographic substitutions for Goldmark Typograph.

This library is not a replacement of the standard Goldmark typography, and only expands its capabilities by adding quotation symbols for different languages. Quotes substitutions based on Wikipedia Page https://en.wikipedia.org/wiki/Quotation_mark. If the substitutions for this language are not specified, the library tries to use substitutions for the base language or default.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(lang ...string) goldmark.Extender

New returns a new goldmark.Extender that replaces punctuations with typographic entities for the specified language.

Example
package main

import (
	"os"

	typographer "github.com/mdigger/goldmark-lang-typographer"
	"github.com/yuin/goldmark"
)

var source = []byte(
	`"Хруст французской булки" -- так заканчивается сказка про колобка братьев Гримм...`)

func main() {
	markdown := goldmark.New(
		goldmark.WithExtensions(
			typographer.New("ru"),
		),
	)

	err := markdown.Convert(source, os.Stdout)
	if err != nil {
		panic(err)
	}

}
Output:

<p>&laquo;Хруст французской булки&raquo; &mdash; так заканчивается сказка про колобка братьев Гримм&hellip;</p>

func Options

func Options(lang ...string) extension.TypographerOption

Options return an TypographerOption options for the TypographerParser.

func Substitutions

func Substitutions(lang ...string) extension.TypographicSubstitutions

Substitutions returns a substitutions of typographic characters for the specified language.

Types

This section is empty.

Jump to

Keyboard shortcuts

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