diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-04-12 10:15:02 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-04-12 14:41:32 +0200 |
commit | 5596dc24a0adc8907f52886a8e035e1bcd66dd8d (patch) | |
tree | 372bece1601ed69fc92e3925e6183b6a1b9293e2 /markup/goldmark/goldmark_config | |
parent | d01731d53c7c9492cb9666a1223419691a95006c (diff) |
markup/goldmark: Add config options for the typographer extension
Note that the config per language part of this will be handled in #10602.
Updates #9772
Diffstat (limited to 'markup/goldmark/goldmark_config')
-rw-r--r-- | markup/goldmark/goldmark_config/config.go | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/markup/goldmark/goldmark_config/config.go b/markup/goldmark/goldmark_config/config.go index ff0b6bbef..f35427ac1 100644 --- a/markup/goldmark/goldmark_config/config.go +++ b/markup/goldmark/goldmark_config/config.go @@ -23,7 +23,19 @@ const ( // DefaultConfig holds the default Goldmark configuration. var Default = Config{ Extensions: Extensions{ - Typographer: true, + Typographer: Typographer{ + Disable: false, + LeftSingleQuote: "‘", + RightSingleQuote: "’", + LeftDoubleQuote: "“", + RightDoubleQuote: "”", + EnDash: "–", + EmDash: "—", + Ellipsis: "…", + LeftAngleQuote: "«", + RightAngleQuote: "»", + Apostrophe: "’", + }, Footnote: true, DefinitionList: true, Table: true, @@ -54,7 +66,7 @@ type Config struct { } type Extensions struct { - Typographer bool + Typographer Typographer Footnote bool DefinitionList bool @@ -66,6 +78,33 @@ type Extensions struct { TaskList bool } +// Typographer holds typographer configuration. +type Typographer struct { + // Whether to disable typographer. + Disable bool + + // Value used for left single quote. + LeftSingleQuote string + // Value used for right single quote. + RightSingleQuote string + // Value used for left double quote. + LeftDoubleQuote string + // Value used for right double quote. + RightDoubleQuote string + // Value used for en dash. + EnDash string + // Value used for em dash. + EmDash string + // Value used for ellipsis. + Ellipsis string + // Value used for left angle quote. + LeftAngleQuote string + // Value used for right angle quote. + RightAngleQuote string + // Value used for apostrophe. + Apostrophe string +} + type Renderer struct { // Whether softline breaks should be rendered as '<br>' HardWraps bool |