This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 43457 - Better indentation for html tags with optional ends
Summary: Better indentation for html tags with optional ends
Status: NEW
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Milutin Kristofic
Depends on:
Reported: 2004-05-18 15:30 UTC by zikmund
Modified: 2015-03-20 08:03 UTC (History)
1 user (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description zikmund 2004-05-18 15:30:18 UTC
See reformatted code:
The <td> tag should be indented. Now it is
probably because of <br>, <p>, <hr>, ... tags
without closing tag pair handling. It could be
improved to distinguish between tags of category

A) <br>, <p>, <hr>, ... -- user doesn't want to
have next tags indented

B) <table>, <tr>, <td>, <dl>, <li>, ... -- user
wants to have next tags indented until the same
tag appears as a sibling

Notice: source is nbusers mailing list.
Comment 1 nmaves 2004-05-18 16:18:40 UTC
I am the original poster of this issue to the nb alias.  I am not sure
that it has anything to do with the tags listed below.


	<td align="right">
		<fmt:message key="login.username"/> :
		<input type="text" name="<fmt:message key="login.username.field"/>">
		<td align="right">
			<fmt:message key="login.password"/>:
			<input type="password" name="<fmt:message


As you can see the first table row (<TR>)  has one <TD> element in it
but is not indented correctly.  I have even removed the custom tag
inclosed in the <TD> and still the formater will not work.

Comment 2 Marek Fukala 2005-09-20 14:29:04 UTC
Though the formatting issue has already been fixed, this is a nice description
of the problem with HTML end-tag autocompletion and indentation. The only html
tags with required end tags are autocompleted and indented. The problem is that
widely and often used tags like <tr> <td> etc. has optional end so they are not
indented when user types them and presses enter.

One possible solution is to create a list of tags with wants to behave like they
have required end and take this list into account when resolving the
end-tag-requireness in the indentation code.
Comment 3 Tomasz Slota 2006-08-22 14:33:19 UTC
We can divide tags into 3 categories (also using HTMLSyntaxSupport) :

1) end tag is required (<table>)
2) end tag is optional (<tr>)
3) end tag is not allowed (<br>)

For now our policy is to encourage users to close tags with optional ending and have a more consistent 
formatting ruleset
Comment 4 morten.bergset 2015-03-20 08:03:49 UTC
In light of HTML5 I would vote for <br> not leading to an ident of next line. Now I have to use <br /> to avoid crappy formatting in my code.