question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML: Remove unnecessary indentation (force no base indentation)

See original GitHub issue

Input

The code looked like this before beautification:

  <div>
  Hello world
</div>

Expected Output

The code should have looked like this after beautification:

<div>
  Hello world
</div>

Actual Output

The code actually looked like this after beautification:

  <div>
    Hello world
  </div>

Steps to Reproduce

  1. Write some HTML with the very first tag indented
  2. Beautify
  3. Observe that the first tag indentation has not been removed. Instead, all other tags have followed suit in using the unnecessary indentation.

See #51 - it looks like this is the designed behavior, but it may be that I accidentally indent the first tag, and I’d prefer to have every file start with no indentation. Any chance of adding a setting for this?

Settings

{
  "end_with_newline": true,
  "indent_size": 2,
  "html": {
    "wrap_attributes": "force-aligned"
  },
  "css": {
    "space_around_selector_separator": true
  }
}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cbejensencommented, May 16, 2019

For anyone trying this it should be "indent_level": 0 (underscore, not dash), though, like @bitwiseman says, it does not seem to make a difference.

0reactions
bitwisemancommented, May 17, 2019

@cbejensen You’d be surprised what breaks whom for this library. We’ve defined the value as a number so we’ll use -1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove indentation from an unordered list item?
I want to remove all indentation from ul . I tried setting margin , padding , text-indent to 0 , but no avail....
Read more >
How to remove indentation from an unordered list item using ...
To remove that indentation from an unordered list (a list having bullets) there needs styling to be done using CSS. The style will...
Read more >
Consistent list indentation - CSS: Cascading Style Sheets | MDN
Since we have no padding for the <ul> element, its content wraps snugly around the three list items. Now we add the list...
Read more >
How to indent or tab text on a web page or in HTML
Steps on how to create a tab or indent text on a web page or in HTML.
Read more >
VS Code tips — Indentation settings and the ... - YouTube
VS Code shows the indentation settings for the current in the status bar. Click on this entry to quickly change the tab size...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found