Prevent out of bounds error when post has no title
This commit is contained in:
parent
0ddca40529
commit
f933b36170
2 changed files with 5 additions and 0 deletions
|
@ -182,6 +182,10 @@ func applyMarkdownSpecial(data []byte, skipNoFollow bool, baseURL string, cfg *c
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyBasicMarkdown(data []byte) string {
|
func applyBasicMarkdown(data []byte) string {
|
||||||
|
if len(data) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
mdExtensions := 0 |
|
mdExtensions := 0 |
|
||||||
blackfriday.EXTENSION_STRIKETHROUGH |
|
blackfriday.EXTENSION_STRIKETHROUGH |
|
||||||
blackfriday.EXTENSION_SPACE_HEADERS |
|
blackfriday.EXTENSION_SPACE_HEADERS |
|
||||||
|
|
|
@ -18,6 +18,7 @@ func TestApplyBasicMarkdown(t *testing.T) {
|
||||||
in string
|
in string
|
||||||
result string
|
result string
|
||||||
}{
|
}{
|
||||||
|
{"empty", "", ""},
|
||||||
{"plain", "Hello, World!", "Hello, World!"},
|
{"plain", "Hello, World!", "Hello, World!"},
|
||||||
{"multibyte", "こんにちは", `こんにちは`},
|
{"multibyte", "こんにちは", `こんにちは`},
|
||||||
{"bold", "**안녕하세요**", `<strong>안녕하세요</strong>`},
|
{"bold", "**안녕하세요**", `<strong>안녕하세요</strong>`},
|
||||||
|
|
Loading…
Add table
Reference in a new issue