2024-01-31 00:15:29 +03:00
|
|
|
# Test parsing and round-trip of doc2 syntax elements
|
|
|
|
|
|
|
|
```ucm:hide
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> builtins.mergeio
|
2024-01-31 00:15:29 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
```unison:hide
|
|
|
|
otherDoc : a -> Doc2
|
|
|
|
otherDoc _ = {{ yo }}
|
|
|
|
|
|
|
|
otherTerm : Nat
|
|
|
|
otherTerm = 99
|
|
|
|
|
|
|
|
fulldoc : Doc2
|
|
|
|
fulldoc =
|
|
|
|
use Nat +
|
|
|
|
{{
|
|
|
|
Heres some text with a
|
|
|
|
soft line break
|
|
|
|
|
|
|
|
hard line break
|
|
|
|
|
2024-02-01 03:19:14 +03:00
|
|
|
Here's a cool **BOLD** __italic__ ~~strikethrough~~ thing with an inline code block `1 + 2`
|
|
|
|
|
|
|
|
Should print with appropriate fences for the contents:
|
|
|
|
|
|
|
|
`No fancy quotes`
|
|
|
|
|
|
|
|
'' There are `backticks` in here ''
|
|
|
|
|
|
|
|
''' There are `backticks` and ''quotes'' in here '''
|
2024-01-31 00:15:29 +03:00
|
|
|
|
|
|
|
# Heading
|
|
|
|
|
|
|
|
## Heading 2
|
|
|
|
|
|
|
|
Term Link: {otherTerm}
|
|
|
|
|
|
|
|
Type Link: {type Optional}
|
|
|
|
|
|
|
|
Term source:
|
|
|
|
|
|
|
|
@source{term}
|
|
|
|
|
|
|
|
Term signature:
|
|
|
|
|
|
|
|
@signature{term}
|
|
|
|
|
|
|
|
* List item
|
|
|
|
|
|
|
|
Inline code:
|
|
|
|
|
|
|
|
`` 1 + 2 ``
|
|
|
|
|
|
|
|
` "doesn't typecheck" + 1 `
|
|
|
|
|
|
|
|
[Link](https://unison-lang.org)
|
|
|
|
|
|
|
|
![Image](https://share-next.unison-lang.org/static/unison-logo-circle.png)
|
|
|
|
|
|
|
|
Horizontal rule
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
Video
|
|
|
|
|
|
|
|
{{
|
|
|
|
Special
|
|
|
|
(Embed
|
|
|
|
(Any (Video [MediaSource "test.mp4" None] [("poster", "test.png")])))
|
|
|
|
}}
|
|
|
|
|
|
|
|
Transclusion/evaluation:
|
|
|
|
|
|
|
|
{{ otherDoc (a -> Word a) }}
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
The following markdown features aren't supported by the Doc format yet, but maybe will someday
|
|
|
|
|
|
|
|
|
|
|
|
> Block quote
|
|
|
|
|
|
|
|
|
|
|
|
Table
|
|
|
|
|
|
|
|
| Header 1 | Header 2 |
|
|
|
|
| -------- | -------- |
|
|
|
|
| Cell 1 | Cell 2 |
|
|
|
|
|
|
|
|
|
|
|
|
Indented Code block
|
|
|
|
|
|
|
|
'''
|
2024-01-31 01:36:37 +03:00
|
|
|
Exact whitespace should be preserved across multiple updates. Don't mess with the logo!
|
2024-01-31 00:15:29 +03:00
|
|
|
|
|
|
|
_____ _
|
|
|
|
| | |___|_|___ ___ ___
|
|
|
|
| | | | |_ -| . | |
|
|
|
|
|_____|_|_|_|___|___|_|_|
|
2024-02-01 00:03:25 +03:00
|
|
|
|
|
|
|
Line with no whitespace:
|
|
|
|
|
2024-01-31 03:22:12 +03:00
|
|
|
Should have one full trailing newline below here:
|
|
|
|
|
2024-01-31 00:15:29 +03:00
|
|
|
'''
|
|
|
|
|
|
|
|
Inline '' text literal with 1 space of padding '' in the middle of a sentence.
|
|
|
|
|
2024-02-01 00:03:25 +03:00
|
|
|
|
2024-01-31 00:15:29 +03:00
|
|
|
}}
|
|
|
|
```
|
|
|
|
|
2024-02-01 00:03:25 +03:00
|
|
|
Format it to check that everything pretty-prints in a valid way.
|
|
|
|
|
2024-01-31 00:15:29 +03:00
|
|
|
```ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.format
|
2024-01-31 00:15:29 +03:00
|
|
|
```
|