Skip to content

Commit 14cd96e

Browse files
committed
disallow raw specifiers in most places
1 parent 6cde9d1 commit 14cd96e

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

crates/quarto_markdown_pandoc/src/pandoc/treesitter.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,14 @@ fn native_visitor<T: Write>(
468468
continue;
469469
}
470470
match child {
471+
PandocNativeIntermediate::IntermediateRawFormat(_, _) => {
472+
// TODO show position of this error
473+
let _ = writeln!(
474+
image_buf,
475+
"Raw specifiers are unsupported in images: {}. Will ignore.",
476+
node_text()
477+
);
478+
},
471479
PandocNativeIntermediate::IntermediateAttr(a) => attr = a,
472480
PandocNativeIntermediate::IntermediateBaseText(text, _) => {
473481
if node == "link_destination" {
@@ -478,7 +486,7 @@ fn native_visitor<T: Write>(
478486
// TODO show position of this error
479487
let _ = writeln!(
480488
image_buf,
481-
"Language specifiers are unsupported in spans: {}",
489+
"Language specifiers are unsupported in images: {}",
482490
node_text()
483491
);
484492
} else {
@@ -503,12 +511,20 @@ fn native_visitor<T: Write>(
503511
PandocNativeIntermediate::IntermediateInlines(native_inlines(children))
504512
}
505513
"inline_link" => {
506-
let mut attr = ("".to_string(), vec![], HashMap::new());
514+
let mut attr: Attr = ("".to_string(), vec![], HashMap::new());
507515
let mut target = ("".to_string(), "".to_string());
508516
let mut content: Vec<Inline> = Vec::new();
509517

510518
for (node, child) in children {
511519
match child {
520+
PandocNativeIntermediate::IntermediateRawFormat(_, _) => {
521+
// TODO show position of this error
522+
let _ = writeln!(
523+
link_buf,
524+
"Raw attribute specifiers are unsupported in links and spans: {}. Ignoring.",
525+
node_text()
526+
);
527+
},
512528
PandocNativeIntermediate::IntermediateAttr(a) => attr = a,
513529
PandocNativeIntermediate::IntermediateBaseText(text, _) => {
514530
if node == "link_destination" {
@@ -519,7 +535,7 @@ fn native_visitor<T: Write>(
519535
// TODO show position of this error
520536
let _ = writeln!(
521537
link_buf,
522-
"Language specifiers are unsupported in spans: {}",
538+
"Language specifiers are unsupported in links and spans: {}. Ignoring.",
523539
node_text()
524540
);
525541
} else {

0 commit comments

Comments
 (0)