Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
350 changes: 350 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions crates/quarto-markdown-pandoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ repository.workspace = true
[package.metadata]
cargo-fuzz = true

[features]
default = ["terminal-hyperlinks"]
terminal-hyperlinks = ["dep:supports-hyperlinks"]

[dependencies]
tree-sitter = { workspace = true }
tree-sitter-qmd = { workspace = true }
Expand All @@ -30,6 +34,8 @@ yaml-rust2 = { workspace = true }
hashlink = { version = "0.10.0", features = ["serde_impl"] }
error-message-macros = { path = "./error-message-macros" }
ariadne = "0.4"
crossterm = "0.28"
supports-hyperlinks = { version = "3.0", optional = true }

[dev-dependencies]
insta = { version = "1.40", features = ["json", "redactions"] }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/quarto-markdown-pandoc/tests/test.rs
expression: output
---
{"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]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/quarto-markdown-pandoc/tests/test.rs
expression: output
---
{"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]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/quarto-markdown-pandoc/tests/test.rs
expression: output
---
[ 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."] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/quarto-markdown-pandoc/tests/test.rs
expression: output
---
[ 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."] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
source: crates/quarto-markdown-pandoc/tests/test.rs
expression: output
---
---
title: Test Document
author: Test Author
---

Content paragraph after metadata.

---

Second paragraph after horizontal rule.
13 changes: 13 additions & 0 deletions crates/quarto-markdown-pandoc/snapshots/qmd/horizontal-rules.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: crates/quarto-markdown-pandoc/tests/test.rs
expression: output
---
First paragraph before the rule.

---

Second paragraph after the rule.

---

Third paragraph.
1 change: 1 addition & 0 deletions crates/quarto-markdown-pandoc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ fn main() {
"native" => writers::native::write(&pandoc, &mut buf),
"markdown" | "qmd" => writers::qmd::write(&pandoc, &mut buf),
"html" => writers::html::write(&pandoc, &mut buf),
"ansi" => writers::ansi::write(&pandoc, &mut buf),
_ => {
eprintln!("Unknown output format: {}", args.to);
return;
Expand Down
Loading