-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not render task-list when it's the first token #3710
Comments
bep
changed the title
Bug > Markdown > Won't render task-list when it's the first token
Does not render task-list when it's the first token
Jul 17, 2017
danieka
pushed a commit
to danieka/hugo
that referenced
this issue
Jul 29, 2017
mpcabd
added a commit
to mpcabd/hugo
that referenced
this issue
Jul 29, 2017
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 gohugoio#3710
Oh I just noticed @danieka's pull-request, I saw the issue yesterday and just managed to test it and work on it, please take whatever solution you like 😄 |
bep
pushed a commit
that referenced
this issue
Aug 1, 2017
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
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The following page:
Outputs the following HTML
Which renders like this
Steps to fix - add any leading content before the task-list
The text was updated successfully, but these errors were encountered: