Skip to content

Commit 5c0466c

Browse files
committed
[HTML] don't indent after DOCTYPE, add indentation tests
1 parent 2c66f1f commit 5c0466c

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

HTML/Indentation Rules.tmPreferences

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
^.* (
2727
# a valid non-self-closing HTML tag that doesn't close itself on the same line
2828
<(?!
29-
!-- # no comment
30-
| [?%] # no section
29+
!-- # no comment
30+
| [?%] # no preprocessor section like PHP/ASP
31+
| !DOCTYPE # no document type
3132
| (?i:area|base|br|col|frame|hr|html|img|input|link|meta|param)[\t\n\f /<>]
3233
)(?:
3334
# tag name
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## SYNTAX TEST reindent "Packages/HTML/HTML.sublime-syntax"
2+
<?xml version="1.0" encoding="utf-8"?>
3+
<!DOCTYPE html>
4+
<html>
5+
<head>
6+
<meta charset="utf-8" />
7+
<title>Page Title Here</title>
8+
<!-- this comment's
9+
indentation should
10+
be unchanged
11+
-->
12+
</head>
13+
<body>
14+
15+
<div class="main">
16+
<span class="something">Blah</span>
17+
<span class="something">
18+
Foobar
19+
</span>
20+
</div>
21+
22+
<script type="text/javascript" src="/some_script.js"></script>
23+
</body>
24+
</html>

0 commit comments

Comments
 (0)