|
local caption = {long = pandoc.Plain(pandoc.Str(el.attributes.caption))} |
If the fenced codeblock for a mermaid diagram doesn't contain a caption this function fails without much information. The TCG "Guide" documents shows the caption in the example but doesn't mandate it. Either permit no caption by not producing an error on this line (bad practice but it we are just brainstorming that would be OK or a better option would be to produce a more informative message saving us having to walk through the log and the filter file to figure it out. My AI suggests:
if not el.attributes.caption or el.attributes.caption == "" then
error("Missing required caption attribute on " .. el.t ..
". Add one like: {caption="My caption text"}")
end
pandoc/filter/convert-diagrams.lua
Line 101 in 7b14e48
If the fenced codeblock for a mermaid diagram doesn't contain a caption this function fails without much information. The TCG "Guide" documents shows the caption in the example but doesn't mandate it. Either permit no caption by not producing an error on this line (bad practice but it we are just brainstorming that would be OK or a better option would be to produce a more informative message saving us having to walk through the log and the filter file to figure it out. My AI suggests:
if not el.attributes.caption or el.attributes.caption == "" then
error("Missing required caption attribute on " .. el.t ..
". Add one like: {caption="My caption text"}")
end