Skip to content

Provide descriptive error for missing mermaid captions #296

Description

@mwiseman32

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions