Skip to content

Commit 1943d9e

Browse files
committed
feat: trim whitespace from concise mode fences
1 parent a8a87bc commit 1943d9e

File tree

26 files changed

+112
-89
lines changed

26 files changed

+112
-89
lines changed

src/__tests__/fixtures/argument-tag-nested-parens/__snapshots__/argument-tag-nested-parens.expected.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
│ ││ │╰─ tagArgs.value "notEmpty(data.colors)"
55
│ ││ ╰─ tagArgs "(notEmpty(data.colors))"
66
│ │╰─ tagName "if"
7-
│ ├─ text "\n"
87
╰─ ╰─ openTagStart
98
3╭─ </if>
109
│ │ │ ╰─ closeTagEnd(if)
1110
│ │ ╰─ closeTagName "if"
12-
│ ├─ text "\n"
1311
╰─ ╰─ closeTagStart "</"
14-
4╭─ ---
15-
╰─ ╰─ text "\n"
12+
4╰─ ---

src/__tests__/fixtures/complex/__snapshots__/complex.expected.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
1╭─ --
22
2╭─ This is top-level text
3-
╰─ ╰─ text "\nThis is top-level text\n"
3+
╰─ ╰─ text "This is top-level text"
44
3├─ --
55
4╭─ p
66
╰─ ╰─ tagName
77
5╭─ --
88
╰─ ╰─ openTagEnd
99
6╭─ This is text that spans multiple lines.
10-
╰─ ╰─ text "\n This is text that spans multiple lines.\n\n "
10+
╰─ ╰─ text "This is text that spans multiple lines.\n"
1111
7├─
1212
8╭─ <strong>You can throw in some HTML markup if you want!</strong>
1313
│ ││ ││ │ │ ╰─ closeTagEnd(strong)
@@ -17,18 +17,20 @@
1717
│ ││ ╰─ openTagEnd
1818
│ │╰─ tagName "strong"
1919
╰─ ╰─ openTagStart
20-
9╭─ --
21-
╰─ ╰─ text "\n"
20+
9├─ --
2221
10╭─ p
2322
│ ├─ closeTagEnd(p)
2423
╰─ ╰─ tagName
2524
11╭─ -----
2625
╰─ ╰─ openTagEnd
2726
12╭─ If you really want to you can change the block delimiter for the following
28-
╰─ ╰─ text "\n If you really want to you can change the block delimiter for the following\n reasons:\n - Avoid accidentally ending a block\n - To improve readability\n"
29-
13├─ reasons:
30-
14├─ - Avoid accidentally ending a block
31-
15├─ - To improve readability
27+
╰─ ╰─ text "If you really want to you can change the block delimiter for the following"
28+
13╭─ reasons:
29+
╰─ ╰─ text "reasons:"
30+
14╭─ - Avoid accidentally ending a block
31+
╰─ ╰─ text "- Avoid accidentally ending a block"
32+
15╭─ - To improve readability
33+
╰─ ╰─ text "- To improve readability"
3234
16├─ -----
3335
17╭─ i -- This text will be in italics
3436
│ │ │ ╰─ text "This text will be in italics"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
1╭─ --
22
2╭─ hi
3-
╰─ ╰─ text "\nhi\n"
3+
╰─ ╰─ text "hi"
44
3├─ --
55
4├─
66
5├─ --
77
6╭─ foo
8-
╰─ ╰─ text "\nfoo\n\n"
8+
╰─ ╰─ text "foo"
99
7├─
1010
8╰─

src/__tests__/fixtures/double-hyphen-block/__snapshots__/double-hyphen-block.expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
6╭─ ---
2121
╰─ ╰─ openTagEnd
2222
7╭─ var a = 'marko';
23-
╰─ ╰─ text "\n var a = 'marko';\n"
23+
╰─ ╰─ text "var a = 'marko';"
2424
8╭─ ---
2525
│ ├─ closeTagEnd(html)
2626
│ ├─ closeTagEnd(body)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
1╭─ ---
2-
2╭─ ---
3-
╰─ ╰─ text "\n"
2+
2╰─ ---

src/__tests__/fixtures/multiline-html-block-missing-end/__snapshots__/multiline-html-block-missing-end.expected.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@
33
2╭─ --
44
╰─ ╰─ openTagEnd
55
3╭─ Hello World
6-
╰─ ╰─ text "\n Hello World\n Hello Again\n"
7-
4├─ Hello Again
6+
╰─ ╰─ text "Hello World"
7+
4╭─ Hello Again
8+
╰─ ╰─ text "Hello Again"
89
5├─
910
6╭─ script --
1011
│ │ ╰─ openTagEnd
1112
│ ├─ closeTagEnd(div)
1213
╰─ ╰─ tagName "script"
1314
7╭─ console.log('foo');
14-
╰─ ╰─ text "\n console.log('foo');\n alert('bar');\n"
15-
8├─ alert('bar');
15+
╰─ ╰─ text "console.log('foo');"
16+
8╭─ alert('bar');
17+
╰─ ╰─ text "alert('bar');"
1618
9├─
1719
10╭─ --
1820
╰─ ╰─ closeTagEnd(script)
1921
11╭─ Multi-line text
20-
╰─ ╰─ text "\nMulti-line text\nReached EOF"
22+
╰─ ╰─ text "Multi-line text\nReached EOF"
2123
12╰─ Reached EOF

src/__tests__/fixtures/multiline-html-block-nested-empty/__snapshots__/multiline-html-block-nested-empty.expected.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
2╭─ ---
44
╰─ ╰─ openTagEnd
55
3╭─ ---
6-
│ │ ╰─ closeTagEnd(p)
7-
╰─ ╰─ text "\n"
6+
╰─ ╰─ closeTagEnd(p)

src/__tests__/fixtures/multiline-html-block-nested/__snapshots__/multiline-html-block-nested.expected.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
2╭─ ---
44
╰─ ╰─ openTagEnd
55
3╭─ Hello <strong>Frank</strong>
6-
││ ││ │ │ ╰─ closeTagEnd(strong)
7-
││ ││ │ ╰─ closeTagName "strong"
8-
││ ││ ╰─ closeTagStart "</"
9-
││ │╰─ text "Frank"
10-
││ ╰─ openTagEnd
11-
│╰─ tagName "strong"
12-
╰─ openTagStart
13-
╰─ ╰─ text "\n Hello "
6+
││ ││ │ │ ╰─ closeTagEnd(strong)
7+
││ ││ │ ╰─ closeTagName "strong"
8+
││ ││ ╰─ closeTagStart "</"
9+
││ │╰─ text "Frank"
10+
││ ╰─ openTagEnd
11+
│╰─ tagName "strong"
12+
╰─ openTagStart
13+
╰─ ╰─ text "Hello "
1414
4╭─ Line 2
15-
╰─ ╰─ text "\n Line 2\n"
15+
╰─ ╰─ text "Line 2"
1616
5╭─ ---
1717
╰─ ╰─ closeTagEnd(p)

src/__tests__/fixtures/multiline-html-block-same-line/__snapshots__/multiline-html-block-same-line.expected.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
│ │ ╰─ openTagEnd
33
╰─ ╰─ tagName "div"
44
2╭─ Hello World
5-
╰─ ╰─ text "\n Hello World\n Hello Again\n"
6-
3├─ Hello Again
5+
╰─ ╰─ text "Hello World"
6+
3╭─ Hello Again
7+
╰─ ╰─ text "Hello Again"
78
4├─ --
89
5╭─ span --
910
│ │ ╰─ openTagEnd
1011
╰─ ╰─ tagName "span"
1112
6╭─ Goodbye
12-
╰─ ╰─ text "\n Goodbye\n"
13+
╰─ ╰─ text "Goodbye"
1314
7╭─ --
1415
│ ├─ closeTagEnd(div)
1516
╰─ ╰─ closeTagEnd(span)

src/__tests__/fixtures/multiline-html-block/__snapshots__/multiline-html-block.expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
│ │ ││ ╰─ openTagEnd
88
│ │ │╰─ tagName "strong"
99
│ │ ╰─ openTagStart
10-
╰─ ╰─ text "\nHello "
10+
╰─ ╰─ text "Hello "
1111
3╭─ Line 2
12-
╰─ ╰─ text "\nLine 2\n"
12+
╰─ ╰─ text "Line 2"
1313
4╰─ ---

0 commit comments

Comments
 (0)