File tree Expand file tree Collapse file tree 3 files changed +53
-1
lines changed
unison-syntax/src/Unison/Syntax Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,21 @@ structural type Optional a = More Text
48
48
49
49
{{ A doc before a type with no type-vars }}
50
50
type Two = One Nat | Two Text
51
+
52
+ -- Regression for https://github.com/unisonweb/unison/issues/4669
53
+
54
+ multilineBold = {{
55
+
56
+ **This paragraph is really really really really really long and spans multiple lines
57
+ with a strike-through block**
58
+
59
+ _This paragraph is really really really really really long and spans multiple lines
60
+ with a strike-through block_
61
+
62
+ ~This paragraph is really really really really really long and spans multiple lines
63
+ with a strike-through block~
64
+
65
+ }}
51
66
```
52
67
53
68
``` ucm
Original file line number Diff line number Diff line change @@ -44,6 +44,21 @@ structural type Optional a = More Text
44
44
45
45
{{ A doc before a type with no type-vars }}
46
46
type Two = One Nat | Two Text
47
+
48
+ -- Regression for https://github.com/unisonweb/unison/issues/4669
49
+
50
+ multilineBold = {{
51
+
52
+ **This paragraph is really really really really really long and spans multiple lines
53
+ with a strike-through block**
54
+
55
+ _This paragraph is really really really really really long and spans multiple lines
56
+ with a strike-through block_
57
+
58
+ ~This paragraph is really really really really really long and spans multiple lines
59
+ with a strike-through block~
60
+
61
+ }}
47
62
```
48
63
49
64
``` ucm
@@ -91,6 +106,20 @@ structural type Optional a = More Text | Some | Other a | None Nat
91
106
92
107
Two.doc = {{ A doc before a type with no type-vars }}
93
108
type Two = One Nat | Two Text
109
+
110
+ -- Regression for https://github.com/unisonweb/unison/issues/4669
111
+
112
+ multilineBold =
113
+ {{
114
+ **This paragraph is really really really really really long and spans
115
+ multiple lines with a strike-through block**
116
+
117
+ __This paragraph is really really really really really long and spans
118
+ multiple lines with a strike-through block__
119
+
120
+ ~~This paragraph is really really really really really long and spans
121
+ multiple lines with a strike-through block~~
122
+ }}
94
123
```
95
124
96
125
Formatter should leave things alone if the file doesn't typecheck.
Original file line number Diff line number Diff line change @@ -587,6 +587,14 @@ lexemes' eof =
587
587
nonNewlineSpace ch = isSpace ch && ch /= ' \n ' && ch /= ' \r '
588
588
nonNewlineSpaces = P. takeWhileP Nothing nonNewlineSpace
589
589
590
+ -- Allows whitespace or a newline, but not more than two newlines in a row.
591
+ whitespaceWithoutParagraphBreak :: P ()
592
+ whitespaceWithoutParagraphBreak = void do
593
+ void nonNewlineSpaces
594
+ optional newline >>= \ case
595
+ Just _ -> void nonNewlineSpaces
596
+ Nothing -> pure ()
597
+
590
598
fencedBlock =
591
599
P. label " block eval (syntax: a fenced code block)" $
592
600
evalUnison <|> exampleBlock <|> other
@@ -651,7 +659,7 @@ lexemes' eof =
651
659
wrap (name end) . wrap " syntax.docParagraph" $
652
660
join
653
661
<$> P. someTill
654
- (leafy (closing <|> (void $ lit end)) <* nonNewlineSpaces )
662
+ (leafy (closing <|> (void $ lit end)) <* whitespaceWithoutParagraphBreak )
655
663
(lit end)
656
664
657
665
externalLink =
You can’t perform that action at this time.
0 commit comments