Skip to content

Commit 731f4a2

Browse files
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.
2 parents b7e80d2 + 41ed666 commit 731f4a2

File tree

8 files changed

+634
-188
lines changed

8 files changed

+634
-188
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "technique"
3-
version = "0.3.3"
3+
version = "0.3.4"
44
edition = "2021"
55
description = "A domain specific language for procedures."
66
authors = [ "Andrew Cowie" ]

0 commit comments

Comments
 (0)