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

Indentation is incorrect for HTML5 void tag <source> #692

Closed
TrevorPT opened this issue May 16, 2015 · 4 comments
Closed

Indentation is incorrect for HTML5 void tag <source> #692

TrevorPT opened this issue May 16, 2015 · 4 comments
Milestone

Comments

@TrevorPT
Copy link

TrevorPT commented May 16, 2015

Hello, I think I came across a bug in 1.5.4 (also present in 1.5.5): indentation is incorrect for HTML5 void tag <source> used with <audio> and <video>.

Input:

<video poster="big_buck_bunny_trailer_480p.jpg" controls="controls" width="150" height="85">
<source src="big_buck_bunny_trailer_iphone.m4v" type="video/x-m4v">
<source src="big_buck_bunny_trailer_480p_baseline.mp4" type="video/mp4">
<source src="big_buck_bunny_trailer_480p.webm" type="video/webm">
<source src="big_buck_bunny_trailer_400p.ogv" type="video/ogg">
</video>

Output:

<video poster="big_buck_bunny_trailer_480p.jpg" controls="controls" width="150" height="85">
  <source src="big_buck_bunny_trailer_iphone.m4v" type="video/x-m4v">
    <source src="big_buck_bunny_trailer_480p_baseline.mp4" type="video/mp4">
      <source src="big_buck_bunny_trailer_480p.webm" type="video/webm">
        <source src="big_buck_bunny_trailer_400p.ogv" type="video/ogg">
</video>

Expected:

<video poster="big_buck_bunny_trailer_480p.jpg" controls="controls" width="150" height="85">
  <source src="big_buck_bunny_trailer_iphone.m4v" type="video/x-m4v">
  <source src="big_buck_bunny_trailer_480p_baseline.mp4" type="video/mp4">
  <source src="big_buck_bunny_trailer_480p.webm" type="video/webm">
  <source src="big_buck_bunny_trailer_400p.ogv" type="video/ogg">
</video>

The indentation is correct if the <source> tags are closed using /> but I believe (someone correct me if I'm wrong) that <source ...> is valid HTML5 without the closing />.

Here are the options I am using:

{
  indent_inner_html: false,
  indent_size: 2,
  indent_char: ' ',
  brace_style: 'collapse',
  indent_scripts: 'normal',
  wrap_line_length: 0,
  preserve_newlines: true,
  max_preserve_newlines: 10,
  unformatted: '',
  end_with_newline: true
}

Thanks.

@bitwiseman
Copy link
Member

😱 It is 2015, and html still can't go ahead and be valid xhtml. 😭

@bitwiseman bitwiseman added this to the v1.5.6 milestone May 27, 2015
@TrevorPT
Copy link
Author

Haha, yeah, they just couldn't take HTML5 that next step. Thanks very much.

@50l3r
Copy link

50l3r commented Mar 29, 2019

I have this issue in VSCode 1.32.3

img

I only can find a fix, adding video tag to unformated tags:

"html.format.contentUnformatted": "video"

@bitwiseman bitwiseman reopened this Apr 8, 2019
@bitwiseman
Copy link
Member

Hm, this doesn't happen on beautifier.io. Not sure why you're seeing this.

Output:

<div>
    <video poster="big_buck_bunny_trailer_480p.jpg" controls="controls" width="150" height="85">
        <source src="big_buck_bunny_trailer_iphone.m4v" type="video/x-m4v">
        <source src=" big_buck_bunny_trailer_480p_baseline.mp4" type="video/mp4">
        <source src="big_buck_bunny_trailer_480p.webm" type="video/webm">
        <source src="big_buck_bunny_trailer_400p.ogv" type="video/ogg">
    </video>
</div>

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

3 participants