Skip to content

Commit ad92357

Browse files
authored
Do not recurse on auto_id adding if header didn't change (#15)
* only recurse if attr changed * regression test
1 parent 064b9d9 commit ad92357

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

crates/quarto_markdown_pandoc/src/pandoc/treesitter.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,8 +1820,12 @@ fn desugar(doc: Pandoc) -> Result<Pandoc, Vec<String>> {
18201820
let mut attr = header.attr.clone();
18211821
if attr.0.is_empty() {
18221822
attr.0 = autoid::auto_generated_id(&header.content);
1823-
header.attr = attr;
1824-
FilterResult(vec![Block::Header(header)], true)
1823+
if !is_empty_attr(&attr) {
1824+
header.attr = attr;
1825+
FilterResult(vec![Block::Header(header)], true)
1826+
} else {
1827+
Unchanged(header)
1828+
}
18251829
} else {
18261830
Unchanged(header)
18271831
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# $any$
2+
3+
https://github.com/quarto-dev/quarto-markdown/issues/14

0 commit comments

Comments
 (0)