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
4848
4949{{ A doc before a type with no type-vars }}
5050type 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+ }}
5166```
5267
5368``` ucm
Original file line number Diff line number Diff line change @@ -44,6 +44,21 @@ structural type Optional a = More Text
4444
4545{{ A doc before a type with no type-vars }}
4646type 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+ }}
4762```
4863
4964``` ucm
@@ -91,6 +106,20 @@ structural type Optional a = More Text | Some | Other a | None Nat
91106
92107Two.doc = {{ A doc before a type with no type-vars }}
93108type 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+ }}
94123```
95124
96125Formatter 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 =
587587 nonNewlineSpace ch = isSpace ch && ch /= ' \n ' && ch /= ' \r '
588588 nonNewlineSpaces = P. takeWhileP Nothing nonNewlineSpace
589589
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+
590598 fencedBlock =
591599 P. label " block eval (syntax: a fenced code block)" $
592600 evalUnison <|> exampleBlock <|> other
@@ -651,7 +659,7 @@ lexemes' eof =
651659 wrap (name end) . wrap " syntax.docParagraph" $
652660 join
653661 <$> P. someTill
654- (leafy (closing <|> (void $ lit end)) <* nonNewlineSpaces )
662+ (leafy (closing <|> (void $ lit end)) <* whitespaceWithoutParagraphBreak )
655663 (lit end)
656664
657665 externalLink =
You can’t perform that action at this time.
0 commit comments