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

Neutralize or remove illegal self-closing tags #18

Merged
merged 2 commits into from
Sep 1, 2023

Commits on Aug 12, 2023

  1. Neutralize or remove illegal self-closing tags

    Given default settings `balance=1` and `keep_bad=6` and the following
    input HTML code:
    
        <p>Hello world</p>
        <figure />
        <p>Lorem Ipsum</p>
    
    `hl_tag` and `hl_balance` incorrectly return this, which can lead to
    broken structure:
    
        <p>Hello world</p>
        <figure>
        <p>Lorem Ipsum</p>
        </figure>
    
    So this change lets `hl_tag` neutralize or remove "self-closing" tags
    for which an ending tag is mandatory according to the HTML spec.
    
    Then, the input HTML code above would now be transformed to the
    following code:
    
        <p>Hello world</p>
        <p>Lorem Ipsum</p>
    
    As a side note, `keep_bad=5` would make HTMLawed to return the
    following:
    
        <p>Hello world</p>
        &lt;figure /&gt;
        <p>Lorem Ipsum</p>
    
    References:
    - https://developer.mozilla.org/en-US/docs/Glossary/Void_element
    - https://developer.mozilla.org/en-US/docs/Glossary/Void_element#self-closing_tags
    
    Signed-off-by: Kevin Decherf <[email protected]>
    Kdecherf committed Aug 12, 2023
    Configuration menu
    Copy the full SHA
    e50e630 View commit details
    Browse the repository at this point in the history
  2. fixup! Neutralize or remove illegal self-closing tags

    Signed-off-by: Kevin Decherf <[email protected]>
    Kdecherf committed Aug 12, 2023
    Configuration menu
    Copy the full SHA
    2295cf7 View commit details
    Browse the repository at this point in the history