allow backticks in docs

This commit is contained in:
Paul Chiusano 2023-07-17 17:35:51 -04:00
parent e70a94267a
commit 6c05f1560b
3 changed files with 9 additions and 6 deletions

View File

@ -6,7 +6,7 @@ basicFormatting = {{
have a title and 0 or more paragraphs or other section elements.
Text can be **bold**, __italicized__, ~~strikethrough~~, or
''monospaced''.
''monospaced'' (or `monospaced`).
You can link to Unison terms, types, and external URLs:

View File

@ -114,7 +114,7 @@ and the rendered output using `display`:
section elements.
Text can be **bold**, __italicized__, ~~strikethrough~~,
or ''monospaced''.
or ''monospaced'' (or ''monospaced'').
You can link to Unison terms, types, and external URLs:
@ -141,7 +141,7 @@ and the rendered output using `display`:
elements.
Text can be bold, *italicized*, ~~strikethrough~~, or
`monospaced`.
`monospaced` (or `monospaced`).
You can link to Unison terms, types, and external URLs:
@ -581,7 +581,7 @@ Lastly, it's common to build longer documents including subdocuments via `{{ sub
section elements.
Text can be bold, *italicized*, ~~strikethrough~~, or
`monospaced`.
`monospaced` (or `monospaced`).
You can link to Unison terms, types, and external URLs:

View File

@ -499,9 +499,12 @@ lexemes' eof =
stop' = maybe stop end (lastMay after)
verbatim =
P.label "code (examples: ''**unformatted**'', '''_words_''')" $ do
P.label "code (examples: ''**unformatted**'', `words` or '''_words_''')" $ do
(start, txt, stop) <- positioned $ do
quotes <- lit "''" <+> many (P.satisfy (== '\''))
-- a single backtick followed by a non-backtick is treated as monospaced
let tick = P.try (lit "`" <* P.lookAhead (P.satisfy (/= '`')))
-- also two or more ' followed by that number of closing '
quotes <- tick <|> (lit "''" <+> many (P.satisfy (== '\'')))
P.someTill P.anySingle (lit quotes)
if all isSpace $ takeWhile (/= '\n') txt
then