created a tiny CLI that takes a typst source code as input and return the highlighted html version of the source code

This commit is contained in:
didier amyot committed 2023-04-29 20:37:33 -04:00
commit a49a09cc0a
6 files changed
+1053

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
use typst::syntax::parse_code;
use std::io;
use std::io::Read;
fn main() -> io::Result<()> {
let mut stdin = io::stdin(); // We get `Stdin` here.
let mut buffer = Vec::new();
stdin.read_to_end(&mut buffer)?;
let input_string = std::str::from_utf8(& buffer).unwrap();
let node = parse_code(input_string);
let highlighted = typst::ide::highlight_html(&node);
println!("{}", highlighted);
Ok(())
}