Hugo 源码修改BlackFriday配置


原文链接: Hugo 源码修改BlackFriday配置
  2 modified: helpers/content.go
  4 @ content.go:115 @ type BlackFriday struct {
  5     LatexDashes           bool      
  6     TaskLists             bool
  7     PlainIDAnchors        bool
  8     Nofollow              bool      
  9     Noreferrer            bool
 10     Extensions            []string
 11     ExtensionsMask        []string
 12 }
 13 @ content.go:133 @ func newBlackfriday(config map[string]interface{}) *BlackFriday {
 14         "latexDashes":           true,
 15         "plainIDAnchors":        true,
 16         "taskLists":             true,
 17         "nofollow":              true,
 18         "noreferrer":            true,
 19     }
 20
 21     ToLowerMap(defaultParam)
 22 @ content.go:267 @ func (c *ContentSpec) getHTMLRenderer(defaultFlags int, ctx *RenderingContext) b
 23     if ctx.Config.Smartypants {
 24         htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
 25     }
 26
 27     if ctx.Config.Nofollow {
 28         htmlFlags |= blackfriday.HTML_NOFOLLOW_LINKS
 29     }
 30     if ctx.Config.Noreferrer {
 31         htmlFlags |= blackfriday.HTML_NOREFERRER_LINKS
 32     }
 33     if ctx.Config.SmartypantsQuotesNBSP {
 34         htmlFlags |= blackfriday.HTML_SMARTYPANTS_QUOTES_NBSP
 35     }
`