Skip to content

Commit 37ce045

Browse files
authored
Merge pull request #5105 from quarto-dev/bugfix/5103
Docusarus: recurse into custom writers
2 parents 6d3aa57 + 35fd0b3 commit 37ce045

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/resources/extensions/quarto/docusaurus/docusaurus_writer.lua

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ local function jsx(content)
1212
return pandoc.RawBlock("markdown", content)
1313
end
1414

15-
local function tabset(node)
15+
local function tabset(node, filter)
1616
-- note groupId
1717
local groupId = ""
1818
local group = node.attr.attributes["group"]
@@ -30,7 +30,7 @@ local function tabset(node)
3030
local title = node.tabs[i].title
3131

3232
tabs.content:insert(jsx(([[<TabItem value="%s">]]):format(pandoc.utils.stringify(title))))
33-
tabs.content:extend(content)
33+
tabs.content:extend(quarto._quarto.ast.walk(content, filter))
3434
tabs.content:insert(jsx("</TabItem>"))
3535
end
3636

@@ -45,8 +45,8 @@ local function tabset(node)
4545
end
4646

4747
function Writer(doc, opts)
48-
49-
doc = quarto._quarto.ast.walk(doc, {
48+
local filter
49+
filter = {
5050
DecoratedCodeBlock = function(node)
5151
local el = node.code_block
5252
local lang = el.attr.classes[1]
@@ -65,19 +65,23 @@ function Writer(doc, opts)
6565
return nil
6666
end,
6767

68-
Tabset = tabset,
68+
Tabset = function(node)
69+
return tabset(node, filter)
70+
end,
6971

7072
Callout = function(node)
7173
local admonition = pandoc.List()
7274
admonition:insert(pandoc.RawBlock("markdown", "\n:::" .. node.type))
7375
if node.title then
7476
admonition:insert(pandoc.Header(2, node.title))
7577
end
76-
admonition:extend(node.content)
78+
admonition:extend(quarto._quarto.ast.walk(node.content, filter))
7779
admonition:insert(pandoc.RawBlock("markdown", ":::\n"))
7880
return admonition
7981
end
80-
})
82+
}
83+
84+
doc = quarto._quarto.ast.walk(doc, filter)
8185

8286
-- insert exports at the top if we have them
8387
if #rawHtmlVars > 0 then

0 commit comments

Comments
 (0)