mirror of
https://github.com/russross/blackfriday.git
synced 2024-03-22 13:40:34 +08:00
Added ability to disable smart parens, fixes #411,
You can now run the following code to disable smart parens: ``` mdOpt = blackfriday.WithRenderer(blackfriday.NewHTMLRenderer(blackfriday.HTMLRendererParameters{ Flags: blackfriday.CommonHTMLFlags ^ blackfriday.SmartypantsParens, })) blackfriday.Run([]byte(...), mdOpt) ```
This commit is contained in:
parent
4c9bf95126
commit
fee6c5a361
1
html.go
1
html.go
|
@ -46,6 +46,7 @@ const (
|
||||||
SmartypantsLatexDashes // Enable LaTeX-style dashes (with Smartypants)
|
SmartypantsLatexDashes // Enable LaTeX-style dashes (with Smartypants)
|
||||||
SmartypantsAngledQuotes // Enable angled double quotes (with Smartypants) for double quotes rendering
|
SmartypantsAngledQuotes // Enable angled double quotes (with Smartypants) for double quotes rendering
|
||||||
SmartypantsQuotesNBSP // Enable « French guillemets » (with Smartypants)
|
SmartypantsQuotesNBSP // Enable « French guillemets » (with Smartypants)
|
||||||
|
SmartypantsParens // Enable smart parens (with Smartypants)
|
||||||
TOC // Generate a table of contents
|
TOC // Generate a table of contents
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ const (
|
||||||
DefinitionLists // Render definition lists
|
DefinitionLists // Render definition lists
|
||||||
|
|
||||||
CommonHTMLFlags HTMLFlags = UseXHTML | Smartypants |
|
CommonHTMLFlags HTMLFlags = UseXHTML | Smartypants |
|
||||||
SmartypantsFractions | SmartypantsDashes | SmartypantsLatexDashes
|
SmartypantsFractions | SmartypantsDashes | SmartypantsLatexDashes | SmartypantsParens
|
||||||
|
|
||||||
CommonExtensions Extensions = NoIntraEmphasis | Tables | FencedCode |
|
CommonExtensions Extensions = NoIntraEmphasis | Tables | FencedCode |
|
||||||
Autolink | Strikethrough | SpaceHeadings | HeadingIDs |
|
Autolink | Strikethrough | SpaceHeadings | HeadingIDs |
|
||||||
|
|
|
@ -411,7 +411,9 @@ func NewSmartypantsRenderer(flags HTMLFlags) *SPRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.callbacks['\''] = r.smartSingleQuote
|
r.callbacks['\''] = r.smartSingleQuote
|
||||||
|
if flags&SmartypantsParens != 0 {
|
||||||
r.callbacks['('] = r.smartParens
|
r.callbacks['('] = r.smartParens
|
||||||
|
}
|
||||||
if flags&SmartypantsDashes != 0 {
|
if flags&SmartypantsDashes != 0 {
|
||||||
if flags&SmartypantsLatexDashes == 0 {
|
if flags&SmartypantsLatexDashes == 0 {
|
||||||
r.callbacks['-'] = r.smartDash
|
r.callbacks['-'] = r.smartDash
|
||||||
|
|
Loading…
Reference in New Issue
Block a user