mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-04 21:57:25 +03:00
Merge pull request #4670 from unisonweb/cp/doc-italics
Allow multi-line bold, italics, and strikethrough
This commit is contained in:
commit
6f6745240e
@ -48,6 +48,21 @@ structural type Optional a = More Text
|
||||
|
||||
{{ A doc before a type with no type-vars }}
|
||||
type Two = One Nat | Two Text
|
||||
|
||||
-- Regression for https://github.com/unisonweb/unison/issues/4669
|
||||
|
||||
multilineBold = {{
|
||||
|
||||
**This paragraph is really really really really really long and spans multiple lines
|
||||
with a strike-through block**
|
||||
|
||||
_This paragraph is really really really really really long and spans multiple lines
|
||||
with a strike-through block_
|
||||
|
||||
~This paragraph is really really really really really long and spans multiple lines
|
||||
with a strike-through block~
|
||||
|
||||
}}
|
||||
```
|
||||
|
||||
```ucm
|
||||
|
@ -44,6 +44,21 @@ structural type Optional a = More Text
|
||||
|
||||
{{ A doc before a type with no type-vars }}
|
||||
type Two = One Nat | Two Text
|
||||
|
||||
-- Regression for https://github.com/unisonweb/unison/issues/4669
|
||||
|
||||
multilineBold = {{
|
||||
|
||||
**This paragraph is really really really really really long and spans multiple lines
|
||||
with a strike-through block**
|
||||
|
||||
_This paragraph is really really really really really long and spans multiple lines
|
||||
with a strike-through block_
|
||||
|
||||
~This paragraph is really really really really really long and spans multiple lines
|
||||
with a strike-through block~
|
||||
|
||||
}}
|
||||
```
|
||||
|
||||
```ucm
|
||||
@ -91,6 +106,20 @@ structural type Optional a = More Text | Some | Other a | None Nat
|
||||
|
||||
Two.doc = {{ A doc before a type with no type-vars }}
|
||||
type Two = One Nat | Two Text
|
||||
|
||||
-- Regression for https://github.com/unisonweb/unison/issues/4669
|
||||
|
||||
multilineBold =
|
||||
{{
|
||||
**This paragraph is really really really really really long and spans
|
||||
multiple lines with a strike-through block**
|
||||
|
||||
__This paragraph is really really really really really long and spans
|
||||
multiple lines with a strike-through block__
|
||||
|
||||
~~This paragraph is really really really really really long and spans
|
||||
multiple lines with a strike-through block~~
|
||||
}}
|
||||
```
|
||||
|
||||
Formatter should leave things alone if the file doesn't typecheck.
|
||||
|
@ -587,6 +587,14 @@ lexemes' eof =
|
||||
nonNewlineSpace ch = isSpace ch && ch /= '\n' && ch /= '\r'
|
||||
nonNewlineSpaces = P.takeWhileP Nothing nonNewlineSpace
|
||||
|
||||
-- Allows whitespace or a newline, but not more than two newlines in a row.
|
||||
whitespaceWithoutParagraphBreak :: P ()
|
||||
whitespaceWithoutParagraphBreak = void do
|
||||
void nonNewlineSpaces
|
||||
optional newline >>= \case
|
||||
Just _ -> void nonNewlineSpaces
|
||||
Nothing -> pure ()
|
||||
|
||||
fencedBlock =
|
||||
P.label "block eval (syntax: a fenced code block)" $
|
||||
evalUnison <|> exampleBlock <|> other
|
||||
@ -651,7 +659,7 @@ lexemes' eof =
|
||||
wrap (name end) . wrap "syntax.docParagraph" $
|
||||
join
|
||||
<$> P.someTill
|
||||
(leafy (closing <|> (void $ lit end)) <* nonNewlineSpaces)
|
||||
(leafy (closing <|> (void $ lit end)) <* whitespaceWithoutParagraphBreak)
|
||||
(lit end)
|
||||
|
||||
externalLink =
|
||||
|
Loading…
Reference in New Issue
Block a user