I am new to Hugo
Hugo generate a p inside li tag: <ul><li><p>text</p></li>
…
My style sheet have a left margin for paragraph indent, but I do not want <li>
to be indented.
Where can I edit to tell Hugo not to put a <p>
tage after the <li>
? Or at lease assign a special class such that I can put into the stylesheet?
Welcome to the forums!
Hugo’s markdown parser is powered by Goldmark (previous it was Blackfriday)
but it does not generate a p tag inside an li unless you have a double line break on your .md file.
See example markdown, not that there is only 1 line break on the - items:
This is a paragraph, followed by a list.
- Item 1
- Item 2
And here is another paragraph.
This is the generated HTML:
<p>This is a paragraph, followed by a list.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<p>And here is another paragraph.</p>
But if you have 2 or more line breaks between the list items, you will get a p tag inside the list:
This is a paragraph, followed by a list.
- Item 1
- Item 2
And here is another paragraph.
This markdown above will generate this HTML:
<p>This is a paragraph, followed by a list.</p>
<ul>
<li>
<p>Item 1</p>
</li>
<li>
<p>Item 2</p>
</li>
</ul>
<p>And here is another paragraph.</p>