Skip to content

Commit e3dc850

Browse files
committed
fix support for crossref callout
1 parent 8b6a9df commit e3dc850

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

src/resources/formats/typst/pandoc/quarto/definitions.typ

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@
117117
// when we cleanup pandoc's emitted code to avoid spaces this will have to change
118118
let old_callout = it.body.children.at(1).body.children.at(1)
119119
let old_title_block = old_callout.body.children.at(0)
120-
let old_title = old_title_block.body.body.children.at(2)
120+
let children = old_title_block.body.body.children
121+
let old_title = if children.len() == 1 {
122+
children.at(0) // no icon: title at index 0
123+
} else {
124+
children.at(1) // with icon: title at index 1
125+
}
121126

122127
// TODO use custom separator if available
123128
let new_title = if empty(old_title) {
@@ -127,12 +132,14 @@
127132
}
128133

129134
let new_title_block = block_with_new_content(
130-
old_title_block,
135+
old_title_block,
131136
block_with_new_content(
132-
old_title_block.body,
133-
old_title_block.body.body.children.at(0) +
134-
old_title_block.body.body.children.at(1) +
135-
new_title))
137+
old_title_block.body,
138+
if children.len() == 1 {
139+
new_title // no icon: just the title
140+
} else {
141+
children.at(0) + new_title // with icon: preserve icon block + new title
142+
}))
136143

137144
block_with_new_content(old_callout,
138145
block(below: 0pt, new_title_block) +

tests/docs/smoke-all/typst/callout-no-icon.qmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ This is a warning callout without an icon.
3434
## Tip Callouts with icon=false {#no-icon-tip}
3535

3636

37-
::: {.callout-tip icon="false"}
37+
::: {#tip-example .callout-tip icon="false"}
3838

3939
A tip without a title and without an icon.
4040

4141
:::
4242

43+
See @tip-example
44+
4345
## Regular callout with icon {#with-icon-important}
4446

4547
::: {.callout-important}

0 commit comments

Comments
 (0)