mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
481924b34d
As per the referenced issue, if the task list in Markdown has nothing before it, it will be rendered wrongly: ``` --- title: "My First Post" date: 2017-07-29T20:21:57+02:00 draft: true --- * [ ] TaskList ``` is rendered as: ``` <ul> class="task-list" <li><input type="checkbox" disabled class="task-list-item"> TaskList</li> </ul> ``` The problem lies in the `List` function of `HugoHTMLRenderer`, it had a hardocded index of `4` for the first `>` of the list, it is used to insert the class into the text before the closing bracket, but that hardcoded index is only right when there is a newline before the opening bracket, which is the case when there is anything in the document before the task list, but if there is nothing, then there is no newline, and the correct index of the first `>` will be `3`. To fix that we're changing the hardcoded index to be dynamic by using `bytes.Index` to find it properly. We're also adding a test case to make sure this is tested against. Fixes #3710 |
||
---|---|---|
.. | ||
baseURL.go | ||
baseURL_test.go | ||
content.go | ||
content_renderer.go | ||
content_renderer_test.go | ||
content_test.go | ||
emoji.go | ||
emoji_test.go | ||
general.go | ||
general_test.go | ||
hugo.go | ||
hugo_test.go | ||
language.go | ||
language_test.go | ||
path.go | ||
path_test.go | ||
pathspec.go | ||
pathspec_test.go | ||
pygments.go | ||
pygments_test.go | ||
testhelpers_test.go | ||
url.go | ||
url_test.go |