From 34f40044d7144dddcd613d60df8e24985158dd8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 13 Jun 2016 19:10:53 +0200 Subject: 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 --- hugolib/shortcode.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hugolib/shortcode.go') 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("

") pEnd := []byte("

") -- cgit v1.2.3