本文整理汇总了Golang中github.com/russross/blackfriday.HtmlRendererParameters.HeaderIDSuffix方法的典型用法代码示例。如果您正苦于以下问题:Golang HtmlRendererParameters.HeaderIDSuffix方法的具体用法?Golang HtmlRendererParameters.HeaderIDSuffix怎么用?Golang HtmlRendererParameters.HeaderIDSuffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/russross/blackfriday.HtmlRendererParameters
的用法示例。
在下文中一共展示了HtmlRendererParameters.HeaderIDSuffix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetHTMLRenderer
// GetHtmlRenderer creates a new Renderer with the given configuration.
func GetHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Renderer {
renderParameters := blackfriday.HtmlRendererParameters{
FootnoteAnchorPrefix: viper.GetString("FootnoteAnchorPrefix"),
FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"),
}
b := len(ctx.DocumentID) != 0
if b && !ctx.getConfig().PlainIDAnchors {
renderParameters.FootnoteAnchorPrefix = ctx.DocumentID + ":" + renderParameters.FootnoteAnchorPrefix
renderParameters.HeaderIDSuffix = ":" + ctx.DocumentID
}
htmlFlags := defaultFlags
htmlFlags |= blackfriday.HTML_USE_XHTML
htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS
if ctx.getConfig().AngledQuotes {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
}
if ctx.getConfig().Fractions {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
}
return blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters)
}
示例2: getHTMLRenderer
// getHTMLRenderer creates a new Blackfriday HTML Renderer with the given configuration.
func getHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Renderer {
renderParameters := blackfriday.HtmlRendererParameters{
FootnoteAnchorPrefix: viper.GetString("FootnoteAnchorPrefix"),
FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"),
}
b := len(ctx.DocumentID) != 0
if b && !ctx.getConfig().PlainIDAnchors {
renderParameters.FootnoteAnchorPrefix = ctx.DocumentID + ":" + renderParameters.FootnoteAnchorPrefix
renderParameters.HeaderIDSuffix = ":" + ctx.DocumentID
}
htmlFlags := defaultFlags
htmlFlags |= blackfriday.HTML_USE_XHTML
htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS
if ctx.getConfig().Smartypants {
htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
}
if ctx.getConfig().AngledQuotes {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
}
if ctx.getConfig().Fractions {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
}
if ctx.getConfig().HrefTargetBlank {
htmlFlags |= blackfriday.HTML_HREF_TARGET_BLANK
}
if ctx.getConfig().SmartDashes {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_DASHES
}
if ctx.getConfig().LatexDashes {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
}
return &HugoHTMLRenderer{
FileResolver: ctx.FileResolver,
LinkResolver: ctx.LinkResolver,
Renderer: blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters),
}
}