make indent string configurable (default 2 spaces)
1 file changed, 13 insertions(+), 13 deletions(-)
changed files
M format_test.go → format_test.go
@@ -24,8 +24,8 @@ { name: "html attribute escaping is normalized", input: `<ol> <li style="&&"> A </li> <li> B </li> </ol> `, expected: `<ol> - <li style="&&">A</li> - <li>B</li> + <li style="&&">A</li> + <li>B</li> </ol> `, },@@ -33,8 +33,8 @@ { name: "bare ampersands are escaped", input: `<ol> <li style="&"> A </li> <li> B </li> </ol> `, expected: `<ol> - <li style="&">A</li> - <li>B</li> + <li style="&">A</li> + <li>B</li> </ol> `, },@@ -42,8 +42,8 @@ { name: "html elements are indented", input: `<ol> <li class="name"> A </li> <li> B </li> </ol> `, expected: `<ol> - <li class="name">A</li> - <li>B</li> + <li class="name">A</li> + <li>B</li> </ol> `, },@@ -65,9 +65,9 @@ { name: "phrasing content element children are kept on the same line, including punctuation", input: `<ul><li><a href="http://example.com">Test</a>.</li></ul>`, expected: `<ul> - <li> - <a href="http://example.com">Test</a>. - </li> + <li> + <a href="http://example.com">Test</a>. + </li> </ul> `, },@@ -89,8 +89,8 @@ { name: "space after text node with punctuation is preserved", input: `<p><a href="https://example.com">Link</a>. <a href="https://example.org">Another</a></p>`, expected: `<p> - <a href="https://example.com">Link</a>. - <a href="https://example.org">Another</a> + <a href="https://example.com">Link</a>. + <a href="https://example.org">Another</a> </p> `, },@@ -98,7 +98,7 @@ { name: "spaces are not added around elements ending with punctuation", input: "<div><time>19:00</time>–<time>20:00</time></div>", expected: `<div> - <time>19:00</time>–<time>20:00</time> + <time>19:00</time>–<time>20:00</time> </div> `, },@@ -130,7 +130,7 @@ }{ { name: "HTML5 doctype is preserved", input: "<!doctype html><html><head></head><body></body></html>", - expected: "<!doctype html>\n<html>\n <head>\n </head> <body>\n </body>\n</html>\n", + expected: "<!doctype html>\n<html>\n <head>\n </head>\n <body>\n </body>\n</html>\n", }, }