Skip to content

feature_request(strip_html): remove extra p tags #1197

@Kristinita

Description

@Kristinita

1. Summary

It would be nice, if StripHTML or any another extension be able to delete extra p tags inside li.

2. Argumentation

  1. It’s extra tags, they aren’t needed.

  2. Interline spacing. See the real list, where items 1, 2 and 3 hasn’t p tag, but items 4 and 5 has:

    p tag interline spacing

    The interline spacing is different. It isn’t the best idea for design.

  3. Extra p tags increase a DOM size. A large DOM tree isn’t the best idea.

3. MCVE

  1. I have a file KiraList.md:

    1. Kira first
    <!--- Kira comment -->
    1. Kira second
  2. python -m markdown KiraList.md:

    <ol>
    <li>Kira first</li>
    </ol>
    <!--- Kira comment -->
    <ol>
    <li>Kira second</li>
    </ol>

    Not good default behavior; I don’t need the second ol.

  3. I found the PyPI extension python-markdown-comments; python -m markdown -x mkdcomments KiraList.md:

    <ol>
    <li>
    <p>Kira first</p>
    </li>
    <li>
    <p>Kira second</p>
    </li>
    </ol>

It’s better, but I can’t found, how I can remove extra p tags.

4. Not helped

  1. Tidy don’t delete these tags by default. I can’t find any option that do it.
  2. Also, I can’t found any plugin for Python Markdown, Pelican (my static site generator) or Grunt that can solve this problem.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    S: triageIssue needs triage.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions