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

list of HTML inline elements incomplete; wraps inappropriately #840

Closed
garretwilson opened this issue Jan 12, 2016 · 2 comments
Closed

list of HTML inline elements incomplete; wraps inappropriately #840

garretwilson opened this issue Jan 12, 2016 · 2 comments

Comments

@garretwilson
Copy link

Over at https://github.com/Glavin001/atom-beautify/ we went round and round trying to find out why atom-beautify was wrapping some elements and http://jsbeautifier.org/ was not. It turns out that your default code has an unformatted option that defaults to not formatting the "inline" elements --- but it's not made explicit what these inline elements are, so we have to dig into the code.

That's when @Glavin001 figured out that you're using these elements as the default list of inline elements:

['a', 'span', 'img', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd',
        'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike',
        'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']

https://github.com/beautify-web/js-beautify/blob/bc5b7b5a3310df19cfe44489f3d0731d0c9b49cf/js/lib/beautify-html.js#L120-L122

Then I realized that this list is incomplete. You don't seem to include all HTML5 inline elements, such as those at:

http://www.w3.org/TR/html5/text-level-semantics.html#text-level-semantics

The first one missing that comes to mind is <mark>. If you leave that out, then you'll wind up wrapping inside of paragraphs, or just in a single list item.

So please revisit your list of "inline" elements and make sure that all HTML5 inline elements are included. Thanks.

@garretwilson
Copy link
Author

Here's as close an official list of inline elements as I could find:

http://www.w3.org/TR/html5/dom.html#phrasing-content

@garretwilson garretwilson changed the title list of HTML inline elements incomple; wraps inappropriately list of HTML inline elements incomplete; wraps inappropriately Jan 14, 2016
@bitwiseman bitwiseman added this to the v1.6.0 milestone Jan 15, 2016
@bitwiseman
Copy link
Member

@Glavin001 - I've pulled an updated list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants