Skip to content

Commit 386ec08

Browse files
ctsatarleb
authored andcommitted
Update diagram-generator to work with pandoc-crossref
This change allows filters like pandoc-crossref and pandoc-fignos to reference the figure number created by diagram-generator.
1 parent c405344 commit 386ec08

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

diagram-generator/diagram-generator.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,17 @@ function CodeBlock(block)
317317
if block.attributes["name"] then
318318
imgObj.attributes["name"] = block.attributes["name"]
319319
end
320+
321+
-- Transfer the identifier from the code block to the new image block
322+
-- to enable downstream filters like pandoc-crossref. This allows a figure
323+
-- block starting with:
324+
--
325+
-- ```{#fig:pumlExample .plantuml caption="This is an image, created by **PlantUML**."}
326+
--
327+
-- to be referenced as @fig:pumlExample outside of the figure.
328+
if block.identifier then
329+
imgObj.identifier = block.identifier
330+
end
320331

321332
-- Finally, put the image inside an empty paragraph. By returning the
322333
-- resulting paragraph object, the source code block gets replaced by

0 commit comments

Comments
 (0)