Skip to content

Commit 9055ec8

Browse files
committed
ansi writer; horizontal rule fix
1 parent 8bcb9ed commit 9055ec8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+8396
-14
lines changed

Cargo.lock

Lines changed: 350 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/quarto-markdown-pandoc/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ repository.workspace = true
1313
[package.metadata]
1414
cargo-fuzz = true
1515

16+
[features]
17+
default = ["terminal-hyperlinks"]
18+
terminal-hyperlinks = ["dep:supports-hyperlinks"]
19+
1620
[dependencies]
1721
tree-sitter = { workspace = true }
1822
tree-sitter-qmd = { workspace = true }
@@ -30,6 +34,8 @@ yaml-rust2 = { workspace = true }
3034
hashlink = { version = "0.10.0", features = ["serde_impl"] }
3135
error-message-macros = { path = "./error-message-macros" }
3236
ariadne = "0.4"
37+
crossterm = "0.28"
38+
supports-hyperlinks = { version = "3.0", optional = true }
3339

3440
[dev-dependencies]
3541
insta = { version = "1.40", features = ["json", "redactions"] }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
source: crates/quarto-markdown-pandoc/tests/test.rs
3+
expression: output
4+
---
5+
{"astContext":{"files":[{"line_breaks":[3,24,44,48,49,83,84,88,89,129],"name":"tests/snapshots/json/horizontal-rules-vs-metadata.qmd","total_length":130}],"metaTopLevelKeySources":{"author":37,"title":35},"sourceInfoPool":[{"d":0,"r":[0,4],"t":0},{"d":0,"r":[4,5],"t":0},{"d":0,"r":[5,13],"t":0},{"d":0,"r":[0,49],"t":0},{"d":3,"r":[4,44],"t":1},{"d":4,"r":[7,20],"t":1},{"d":0,"r":[0,4],"t":0},{"d":0,"r":[4,5],"t":0},{"d":0,"r":[5,11],"t":0},{"d":3,"r":[4,44],"t":1},{"d":9,"r":[29,40],"t":1},{"d":0,"r":[50,57],"t":0},{"d":0,"r":[57,58],"t":0},{"d":0,"r":[58,67],"t":0},{"d":0,"r":[67,68],"t":0},{"d":0,"r":[68,73],"t":0},{"d":0,"r":[73,74],"t":0},{"d":0,"r":[74,82],"t":0},{"d":0,"r":[82,83],"t":0},{"d":[[17,0,8],[18,8,1]],"r":[0,9],"t":2},{"d":0,"r":[50,84],"t":0},{"d":0,"r":[85,89],"t":0},{"d":0,"r":[90,96],"t":0},{"d":0,"r":[96,97],"t":0},{"d":0,"r":[97,106],"t":0},{"d":0,"r":[106,107],"t":0},{"d":0,"r":[107,112],"t":0},{"d":0,"r":[112,113],"t":0},{"d":0,"r":[113,123],"t":0},{"d":0,"r":[123,124],"t":0},{"d":0,"r":[124,128],"t":0},{"d":0,"r":[128,129],"t":0},{"d":[[30,0,4],[31,4,1]],"r":[0,5],"t":2},{"d":0,"r":[90,130],"t":0},{"d":3,"r":[4,44],"t":1},{"d":34,"r":[0,5],"t":1},{"d":3,"r":[4,44],"t":1},{"d":36,"r":[21,27],"t":1}]},"blocks":[{"c":[{"c":"Content","s":11,"t":"Str"},{"s":12,"t":"Space"},{"c":"paragraph","s":13,"t":"Str"},{"s":14,"t":"Space"},{"c":"after","s":15,"t":"Str"},{"s":16,"t":"Space"},{"c":"metadata.","s":19,"t":"Str"}],"s":20,"t":"Para"},{"s":21,"t":"HorizontalRule"},{"c":[{"c":"Second","s":22,"t":"Str"},{"s":23,"t":"Space"},{"c":"paragraph","s":24,"t":"Str"},{"s":25,"t":"Space"},{"c":"after","s":26,"t":"Str"},{"s":27,"t":"Space"},{"c":"horizontal","s":28,"t":"Str"},{"s":29,"t":"Space"},{"c":"rule.","s":32,"t":"Str"}],"s":33,"t":"Para"}],"meta":{"author":{"c":[{"c":"Test","s":6,"t":"Str"},{"s":7,"t":"Space"},{"c":"Author","s":8,"t":"Str"}],"s":10,"t":"MetaInlines"},"title":{"c":[{"c":"Test","s":0,"t":"Str"},{"s":1,"t":"Space"},{"c":"Document","s":2,"t":"Str"}],"s":5,"t":"MetaInlines"}},"pandoc-api-version":[1,23,1]}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
source: crates/quarto-markdown-pandoc/tests/test.rs
3+
expression: output
4+
---
5+
{"astContext":{"files":[{"line_breaks":[32,33,37,38,71,72,76,77,94],"name":"tests/snapshots/json/horizontal-rules.qmd","total_length":95}],"sourceInfoPool":[{"d":0,"r":[0,5],"t":0},{"d":0,"r":[5,6],"t":0},{"d":0,"r":[6,15],"t":0},{"d":0,"r":[15,16],"t":0},{"d":0,"r":[16,22],"t":0},{"d":0,"r":[22,23],"t":0},{"d":0,"r":[23,26],"t":0},{"d":0,"r":[26,27],"t":0},{"d":0,"r":[27,31],"t":0},{"d":0,"r":[31,32],"t":0},{"d":[[8,0,4],[9,4,1]],"r":[0,5],"t":2},{"d":0,"r":[0,33],"t":0},{"d":0,"r":[34,38],"t":0},{"d":0,"r":[39,45],"t":0},{"d":0,"r":[45,46],"t":0},{"d":0,"r":[46,55],"t":0},{"d":0,"r":[55,56],"t":0},{"d":0,"r":[56,61],"t":0},{"d":0,"r":[61,62],"t":0},{"d":0,"r":[62,65],"t":0},{"d":0,"r":[65,66],"t":0},{"d":0,"r":[66,70],"t":0},{"d":0,"r":[70,71],"t":0},{"d":[[21,0,4],[22,4,1]],"r":[0,5],"t":2},{"d":0,"r":[39,72],"t":0},{"d":0,"r":[73,77],"t":0},{"d":0,"r":[78,83],"t":0},{"d":0,"r":[83,84],"t":0},{"d":0,"r":[84,93],"t":0},{"d":0,"r":[93,94],"t":0},{"d":[[28,0,9],[29,9,1]],"r":[0,10],"t":2},{"d":0,"r":[78,95],"t":0}]},"blocks":[{"c":[{"c":"First","s":0,"t":"Str"},{"s":1,"t":"Space"},{"c":"paragraph","s":2,"t":"Str"},{"s":3,"t":"Space"},{"c":"before","s":4,"t":"Str"},{"s":5,"t":"Space"},{"c":"the","s":6,"t":"Str"},{"s":7,"t":"Space"},{"c":"rule.","s":10,"t":"Str"}],"s":11,"t":"Para"},{"s":12,"t":"HorizontalRule"},{"c":[{"c":"Second","s":13,"t":"Str"},{"s":14,"t":"Space"},{"c":"paragraph","s":15,"t":"Str"},{"s":16,"t":"Space"},{"c":"after","s":17,"t":"Str"},{"s":18,"t":"Space"},{"c":"the","s":19,"t":"Str"},{"s":20,"t":"Space"},{"c":"rule.","s":23,"t":"Str"}],"s":24,"t":"Para"},{"s":25,"t":"HorizontalRule"},{"c":[{"c":"Third","s":26,"t":"Str"},{"s":27,"t":"Space"},{"c":"paragraph.","s":30,"t":"Str"}],"s":31,"t":"Para"}],"meta":{},"pandoc-api-version":[1,23,1]}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
source: crates/quarto-markdown-pandoc/tests/test.rs
3+
expression: output
4+
---
5+
[ Para [Str "Content", Space, Str "paragraph", Space, Str "after", Space, Str "metadata."], HorizontalRule, Para [Str "Second", Space, Str "paragraph", Space, Str "after", Space, Str "horizontal", Space, Str "rule."] ]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
source: crates/quarto-markdown-pandoc/tests/test.rs
3+
expression: output
4+
---
5+
[ Para [Str "First", Space, Str "paragraph", Space, Str "before", Space, Str "the", Space, Str "rule."], HorizontalRule, Para [Str "Second", Space, Str "paragraph", Space, Str "after", Space, Str "the", Space, Str "rule."], HorizontalRule, Para [Str "Third", Space, Str "paragraph."] ]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
source: crates/quarto-markdown-pandoc/tests/test.rs
3+
expression: output
4+
---
5+
---
6+
title: Test Document
7+
author: Test Author
8+
---
9+
10+
Content paragraph after metadata.
11+
12+
---
13+
14+
Second paragraph after horizontal rule.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
source: crates/quarto-markdown-pandoc/tests/test.rs
3+
expression: output
4+
---
5+
First paragraph before the rule.
6+
7+
---
8+
9+
Second paragraph after the rule.
10+
11+
---
12+
13+
Third paragraph.

crates/quarto-markdown-pandoc/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ fn main() {
177177
"native" => writers::native::write(&pandoc, &mut buf),
178178
"markdown" | "qmd" => writers::qmd::write(&pandoc, &mut buf),
179179
"html" => writers::html::write(&pandoc, &mut buf),
180+
"ansi" => writers::ansi::write(&pandoc, &mut buf),
180181
_ => {
181182
eprintln!("Unknown output format: {}", args.to);
182183
return;

0 commit comments

Comments
 (0)