-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix raw text-block indentation #4655
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
70c343d
Add round-trip test for doc2
ChrisPenner 203cd8c
Fix whitespace trimming on doc literals
ChrisPenner 6105968
Update transcripts
ChrisPenner b93d289
Clean up whitespace trimming
ChrisPenner d07077e
Fix parsing/printing of raw syntax blocks in transcripts
ChrisPenner e66806f
Update whitespace trimming
ChrisPenner 52c8d40
Update transcripts
ChrisPenner 6f21f73
Update transcripts
ChrisPenner bea3437
Update transcripts
ChrisPenner cb974e7
Newlines within {{ }} for multi-line docs
ChrisPenner 4752b44
Handle lines with only whitespace.
ChrisPenner 1f67d09
Add regression test for empty-lines in raw literals
ChrisPenner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Test parsing and round-trip of doc2 syntax elements | ||
|
||
```ucm:hide | ||
.> builtins.mergeio | ||
``` | ||
|
||
```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 | ||
|
||
Here's a cool **BOLD** __italic__ ~~strikethrough~~ thing with an inline code block ''1 + 2'' | ||
|
||
# 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 | ||
|
||
''' | ||
Exact whitespace should be preserved across multiple updates. Don't mess with the logo! | ||
|
||
_____ _ | ||
| | |___|_|___ ___ ___ | ||
| | | | |_ -| . | | | ||
|_____|_|_|_|___|___|_|_| | ||
Should have one full trailing newline below here: | ||
|
||
''' | ||
|
||
Inline '' text literal with 1 space of padding '' in the middle of a sentence. | ||
|
||
}} | ||
``` | ||
|
||
```ucm | ||
.> debug.format | ||
-- Format it again to ensure multiple round-trips don't cause changes. | ||
.> debug.format | ||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block is a smidge strange, but it does round-trip. Rúnar and I tried to improve it without much luck :'(