diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-06-13 19:10:53 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-06-15 09:12:07 +0200 |
commit | 34f40044d7144dddcd613d60df8e24985158dd8c (patch) | |
tree | abf9f60821adbcbea8a519112c3ea60155c6bdaa /hugolib/shortcode.go | |
parent | 6ba074562c3ca16af352755dc90e78139782f569 (diff) |
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
Diffstat (limited to 'hugolib/shortcode.go')
-rw-r--r-- | hugolib/shortcode.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go index 876e9293f..8ea09feda 100644 --- a/hugolib/shortcode.go +++ b/hugolib/shortcode.go @@ -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>") |