Skip to content

PGML Par can create bad HTML by inserting empty divs for spacing #1355

@somiaj

Description

@somiaj

PGML Implements the Par block in HTML by inserting an empty div with a margin on it for spacing. When used inside of a list this puts these div's as children of ul or ol elements, which is considered invalid HTML.

I don't know the PGML parser that well, but can block elements look forward/backwards, so instead of Par placing the margin as a separate div, the margin is added to the previous block. For example:

BEGIN_PGML
1. First

2. Second

3. Third
END_PGML

Produces the following HTML:

<div class="PGML">
    <ol style="margin:0; padding-left:2.25em; list-style-type: decimal;">
        <li>First</li>
        <div style="margin-top:1em"></div>
        <li>Second</li>
        <div style="margin-top:1em"></div>
        <li>Third</li>
    </ol>
</div>

Instead could the Par blocks some how tag the previous block element so the style is applied there instead like (note placing margin-top on the following block element might also be a possibility):

<div class="PGML">
    <ol style="margin:0; padding-left:2.25em; list-style-type: decimal;">
        <li style="margin-bottom:1em;">First</li>
        <li style="margin-bottom:1em;">Second</li>
        <li>Third</li>
    </ol>
</div>

Tagging @dpvc as I suspect they understand the PGML parser best and if this is possible and how much work it would take to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions