mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
Fix shortcode in markdown headers
This issue was introduced as a fix to shortcode not working in RST. One could argue that Blackfriday and friends should handle `#` in titles, but that will be a discussion for another day. The new placeholder pattern should be RST safe and work with titles. And now with a test so this doesn't break again. Fixes #2192 Fixes #2209 Closes #2210
This commit is contained in:
@@ -45,7 +45,7 @@ func (renderer *HugoHTMLRenderer) BlockCode(out *bytes.Buffer, text []byte, lang
|
||||
}
|
||||
|
||||
func (renderer *HugoHTMLRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
|
||||
if renderer.LinkResolver == nil || bytes.HasPrefix(link, []byte("{#{#HUGOSHORTCODE")) {
|
||||
if renderer.LinkResolver == nil || bytes.HasPrefix(link, []byte("{-{-HUGOSHORTCODE")) {
|
||||
// Use the blackfriday built in Link handler
|
||||
renderer.Renderer.Link(out, link, title, content)
|
||||
} else {
|
||||
@@ -59,7 +59,7 @@ func (renderer *HugoHTMLRenderer) Link(out *bytes.Buffer, link []byte, title []b
|
||||
}
|
||||
}
|
||||
func (renderer *HugoHTMLRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
|
||||
if renderer.FileResolver == nil || bytes.HasPrefix(link, []byte("{#{#HUGOSHORTCODE")) {
|
||||
if renderer.FileResolver == nil || bytes.HasPrefix(link, []byte("{-{-HUGOSHORTCODE")) {
|
||||
// Use the blackfriday built in Image handler
|
||||
renderer.Renderer.Image(out, link, title, alt)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user