Skip to content

Commit 525cb56

Browse files
committed
support title attribute for callouts
1 parent a60f4be commit 525cb56

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/resources/editor/tools/attrs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
contexts: [div]
2121
filter: "\\.callout"
2222
completions:
23+
- value: 'title="$0"'
24+
doc: "Title displayed in callout header"
2325
- value: 'icon="true"'
2426
doc: Include an icon in the callout.
2527
- value: 'icon="false"'

src/resources/filters/quarto-pre/callout.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ _quarto.ast.add_handler({
2828
-- and returns the custom node
2929
parse = function(div)
3030
preState.hasCallouts = true
31-
local title = resolveHeadingCaption(div)
31+
local title = markdownToInlines(div.attr.attributes["title"])
32+
if not title or #title == 0 then
33+
title = resolveHeadingCaption(div)
34+
end
3235
local old_attr = div.attr
3336
local appearanceRaw = div.attr.attributes["appearance"]
3437
local icon = div.attr.attributes["icon"]

0 commit comments

Comments
 (0)