Skip to content
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

Extra <p> tags inside lists after code block #5291

Closed
magic-lantern opened this issue Oct 6, 2018 · 5 comments
Closed

Extra <p> tags inside lists after code block #5291

magic-lantern opened this issue Oct 6, 2018 · 5 comments
Labels

Comments

@magic-lantern
Copy link

I'm using

$hugo version
Hugo Static Site Generator v0.49/extended darwin/amd64 BuildDate: unknown

I have the following example markdown:

1. First item.
1. Second item:
    
    ```r
    library(util)
    #some code
    myvar <- c(1, 2, 3, 4)
    ```
    
1. Third item.
1. Fourth item.


* First item.
* Second item:
    
    ```r
    library(util)
    #some code
    myvar <- c(1, 2, 3, 4)
    ```
    
* Third item.
* Fourth item.

For the rendered html, list items (<li>) before the code block are rendered as <li>text</li> whereas list items after the code block are rendered as <li><p>text</p></li> This different rendering occurs for both ordered and un-ordered lists.

I expect that all list items are rendered the same regardless of location before or after a code block.

Is this expected behavior? Is there a configuration flag that affects this behavior? Perhaps this is a bug/feature in Blackfriday?

@stale
Copy link

stale bot commented Feb 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Feb 4, 2019
@aignas
Copy link

aignas commented Feb 11, 2019

@magic-lantern, do you think that russross/blackfriday#521 fixes your issue?

@stale stale bot removed the Stale label Feb 11, 2019
@magic-lantern
Copy link
Author

Sorry for the delay in getting to this issue. Thanks for pointing out that issue. Looks like russross/blackfriday#521 references 2 separate issues. russross/blackfriday#485 and russross/blackfriday#495 are different problem than what I am experiencing.

Since I reported this issue, there has been a change in behavior though - not sure if it was due to the bug you mentioned or a different one. I'm now on version:

$ hugo version
Hugo Static Site Generator v0.54.0/extended darwin/amd64 BuildDate: unknown

Now it seems that list items that include a code block or are the last item in the list are wrapped in a <p></p> tag - see html output:

<ol style="list-style-type: decimal">
<li>First item.</li>
<li><p>Second item:</p>
<pre class="r"><code>library(util)
#some code
myvar &lt;- c(1, 2, 3, 4)</code></pre></li>
<li>Third item.</li>
<li><p>Fourth item.</p></li>
</ol>
<ul>
<li>First item.</li>
<li><p>Second item:</p>
<pre class="r"><code>library(util)
#some code
myvar &lt;- c(1, 2, 3, 4)</code></pre></li>
<li>Third item.</li>
<li><p>Fourth item.</p></li>
</ul>

Since the behavior now seems more consistent, I think this bug can be closed.

@askmrsinh
Copy link

@magic-lantern , @aignas
For me, this still leads to some inconsistent results. Please have a look at the new issue linked above.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants