mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +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:
@@ -197,7 +197,7 @@ func isInnerShortcode(t *template.Template) (bool, error) {
|
||||
}
|
||||
|
||||
func createShortcodePlaceholder(id int) string {
|
||||
return fmt.Sprintf("{#{#%s-%d#}#}", shortcodePlaceholderPrefix, id)
|
||||
return fmt.Sprintf("{-{-%s-%d-}-}", shortcodePlaceholderPrefix, id)
|
||||
}
|
||||
|
||||
const innerNewlineRegexp = "\n"
|
||||
@@ -507,8 +507,8 @@ func replaceShortcodeTokens(source []byte, prefix string, replacements map[strin
|
||||
sourceLen := len(source)
|
||||
start := 0
|
||||
|
||||
pre := []byte("{#{#" + prefix)
|
||||
post := []byte("#}#}")
|
||||
pre := []byte("{-{-" + prefix)
|
||||
post := []byte("-}-}")
|
||||
pStart := []byte("<p>")
|
||||
pEnd := []byte("</p>")
|
||||
|
||||
|
Reference in New Issue
Block a user