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
Tidy just intent first level, not nested levels #916
Comments
On 12/25/20, Mehdi Dehghani ***@***.***> wrote:
I'm using latest version, imagine following html:
```
<main><header>header</header></main>
```
With this options:
```
indent: auto
indent-with-tabs: yes
keep-tabs: yes
wrap: 0
merge-divs: no
merge-spans: no
tidy-mark: no
```
Expected result would be:
```
<main>
<header>
header
</header>
</main>
```
But Tidy generates this:
```
<main>
<header>
header
</header>
</main>
```
I could not find any related option, is there any way to tell Tidy to intent
nested levels too?
It looks like you found a bug.
Indent with spaces works:
$ cat options
indent: auto
indent-with-tabs: yes
keep-tabs: yes
wrap: 0
merge-divs: no
merge-spans: no
tidy-mark: no
$ cat x.html
<main><header>header</header></main>
$ tidy -config options -quiet x.html
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 1 - Warning: inserting implicit <body>
line 1 column 1 - Warning: inserting missing 'title' element
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<main>
<header>
header
</header>
</main>
</body>
</html>
$ tidy -config options -quiet --indent-with-tabs no --indent-spaces 4 x.html
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 1 - Warning: inserting implicit <body>
line 1 column 1 - Warning: inserting missing 'title' element
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<main>
<header>
header
</header>
</main>
</body>
</html>
and "--indent-with-tabs yes" with "--indent yes" looks broken also
$ tidy --tidy-mark no --indent-with-tabs yes --indent yes -quiet x.html
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 1 - Warning: inserting implicit <body>
line 1 column 1 - Warning: inserting missing 'title' element
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<main>
<header>
header
</header>
</main>
</body>
</html>
Regards,
Lee
|
@dehghani-mehdi, thank you for the issue, and @ler762, thank you for doing some further testing... There certainly seems something WRONG with indenting with tabs!With
I would at least expect something like -
To more or less match the default space
Looking back to when I first implemented the indent-with-tabs option, Nov 2013, issue #108, and a subsequent fix by @balthisar, Nov 2015, merge #290, and #335, maybe #403, and maybe others, I see they also discuss some problems with Look forward to further discussion, code, PR, ... to address this |
Is there a new quick reference somewhere? because indent-with-tabs isn't listed on http://tidy.sourceforge.net/docs/quickref.html |
@Feathered-Serpent thanks for the question... but... OT: BTW, over the years I have noted some old web sites that still have this SF legacy site link, so have now added a note at the top of the page - refresh it in a browser - which should be self explanatory... But even the latest quickref.html online is already back at version You can generate new Hope this answers your question... PS: @Feathered-Serpent, it is not a good idea to put such OT questions, on any existing |
Problem is also in 5.6.0 |
I'm using latest version, imagine following html:
With this options:
Expected result would be:
But Tidy generates this:
I could not find any related option, is there any way to tell Tidy to intent nested levels too?
The text was updated successfully, but these errors were encountered: