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

Fix formatting related to the <menu> element #2114

Merged
merged 2 commits into from
Nov 9, 2022

Conversation

abu-co
Copy link
Contributor

@abu-co abu-co commented Nov 8, 2022

Description

  • Source branch in your fork has a meaningful name (not main)

A minor patch for:

  • correctly formatting nested <menu> tags, such as <li> tags inside <menu> tags inside <li> tags;
  • allowing unclosed <p> tags followed by a <menu> tag.

Basically, <menu> elements should be treated as identical to <ul> elements.

References:

The menu element is simply a semantic alternative to ul to express an unordered list of commands (a "toolbar").
(https://html.spec.whatwg.org/multipage/grouping-content.html#the-menu-element)

A p element's end tag can be omitted if the p element is immediately followed by an address, article, ..., main, menu, nav, ol, ..., table, or ul element, or...
(https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element)

Current output:

<div>
    <p>
        <menu>
            <li>
                <menu>
            <li>
        </menu>
        </li>
        </menu>

    <p>
        <menu></menu>
</div>

After applying the changes proposed in this PR:

<div>
    <p>
    <menu>
        <li>
            <menu>
                <li>
            </menu>
        </li>
    </menu>

    <p>
    <menu></menu>
</div>

Fixes Issue:

Before Merge Checklist

These items can be completed after PR is created.

(Check any items that are not applicable (NA) for this PR)

  • JavaScript implementation
  • Python implementation (NA if HTML beautifier) NA
  • Added tests to data file(s)
  • Added command-line option(s) (NA if NA
  • README.md documents new feature/option(s) NA

- Fix formatting for `<li>` tags inside `<menu>` tags inside `<li>` tags
- Allow unclosed `<p>` tags if followed by a `<menu>` tag
@abu-co abu-co marked this pull request as ready for review November 8, 2022 03:41
@bitwiseman bitwiseman merged commit 49cd14d into beautifier:main Nov 9, 2022
@bitwiseman bitwiseman added this to the v1.14.8 (next release) milestone Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants