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

<script type="text/html">isnot abled to be beautified #1591

Closed
InkoiWong opened this issue Nov 15, 2018 · 1 comment
Closed

<script type="text/html">isnot abled to be beautified #1591

InkoiWong opened this issue Nov 15, 2018 · 1 comment

Comments

@InkoiWong
Copy link

Description

Codes in the <script type="text/html"> aren't able to be beautified.Even "indent_size" does not take effect.Does it support?Or how can I to be able to achieve it.
Pls give me some help.Thanks.

Input

The code looked like this before beautification:

<script type="text/html">
  <div>
    <span>1</span>
      <span>2</span>
        <span>3</span>
  </div>
</script>

Expected Output

The code should have looked like this after beautification:

<script type="text/html">
  <div>
    <span>1</span>
    <span>2</span>
    <span>3</span>
  </div>
</script>

Actual Output

The code actually looked like this after beautification:

<script type="text/html">
  <div>
    <span>1</span>
      <span>2</span>
        <span>3</span>
  </div>
</script>

Steps to Reproduce

Environment

OS:

My Settings

{
  "brace_style": "none,preserve-inline",
  "end_with_newline": true,
  "indent_char": " ",
  "indent_size": 2,
  "wrap_line_length": 0,

  "html": {
    "allowed_file_extensions": ["html"],
    "brace_style": "collapse",
    "indent_handlebars": false,
    "indent_inner_html": false,
    "indent_scripts": "keep",
    "max_preserve_newlines": 1,
    "preserve_newlines": true,
    "unformatted": ["meta", "link", "script", "a", "i"],
    "wrap_attributes": "force-expand-multiline"
  },

  "css": {
    "allowed_file_extensions": ["css", "scss", "sass", "less"],
    "newline_between_rules": true,
    "selector_separator": " ",
    "selector_separator_newline": false,
    "space_around_combinator": true
  },

  "js": {
    "allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"],
    "brace_style": "collapse",
    "break_chained_methods": false,
    "comma_first": false,
    "e4x": false,
    "eval_code": false,
    "indent_level": 0,
    "indent_with_tabs": false,
    "jslint_happy": false,
    "keep_array_indentation": false,
    "keep_function_indentation": false,
    "operator_position": "before-newline",
    "max_preserve_newlines": 2,
    "preserve_newlines": true,
    "space_after_anon_function": false,
    "space_after_named_function": false,
    "space_before_conditional": true,
    "space_in_paren": false,
    "unescape_strings": false
  }
}
@bitwiseman
Copy link
Member

This would not be hard to accomplish. Using the same pattern as the javascript and css, but instead the html beautifier would call itself on text/html script contents.

bitwiseman added a commit to bitwiseman/js-beautify that referenced this issue Dec 9, 2018
Fixes beautifier#1591

NOTE: This is a potentially breaking change to existing behavior.
Whitespace at the start of html used to be ignored.
Now it will be used as the base indent for the rest of the input.
This makes it consistent with the other beautifiers but may change
the behaviors of libraries that use the beautifier.
bitwiseman added a commit to bitwiseman/js-beautify that referenced this issue Dec 9, 2018
Fixes beautifier#1591

NOTE: This is a potentially breaking change to existing behavior.
Whitespace at the start of html used to be ignored.
Now it will be used as the base indent for the rest of the input.
This makes it consistent with the other beautifiers but may change
the behaviors of libraries that use the beautifier.
bitwiseman added a commit to bitwiseman/js-beautify that referenced this issue Dec 9, 2018
Fixes beautifier#1591

NOTE: This is a potentially breaking change to existing behavior.
Whitespace at the start of html used to be ignored.
Now it will be used as the base indent for the rest of the input.
This makes it consistent with the other beautifiers but may change
the behaviors of libraries that use the beautifier.
@bitwiseman bitwiseman modified the milestones: v1.9.x, v1.9.0 Feb 27, 2019
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