Commit 731f4a2
authored
Render syntax highlighted source to terminal (#61)
Implemented by adding two phases to the output formatter. The first pass
makes formatted code fragments and annotates them with a Syntax tag, and
the second pass applies renderer dependent embellishment as appropriate
for each tag.
There are three renderers: Identity (returns content unchanged, with no
markup applied), Terminal (embellishes fragments with ANSI escapes to
create syntax highlighting in
terminal output), and Typst (which will be for adding markup around
syntactic elements for use when including Technique source in Typst
documents).
Placed syntax highlighting ANSI escapes into terminal output mostly
matching what we are using for paper output, and fixed endless corner
cases.
Finally hooked up the detection of whether or not output is to terminal,
restoring the behaviour of the `-R` flag to the _format_ command.File tree
8 files changed
+634
-188
lines changed- src
- formatting
- rendering
- tests/formatting
8 files changed
+634
-188
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments