Skip to content

fix: validate pandoc attribute content during parsing - #6567

Open
costajohnt wants to merge 2 commits into
Zettlr:developfrom
costajohnt:fix/6563-curly-braces-table-cells
Open

costajohnt wants to merge 2 commits into
Zettlr:developfrom
costajohnt:fix/6563-curly-braces-table-cells

Conversation

@costajohnt

@costajohnt costajohnt commented Sep 18, 2026 •

Copy link
Copy Markdown

Description

Braces at the end of a table cell disappeared in the editor because the parser read them as a pandoc attribute. This change makes it so we only treat braces as attributes when they actually look like them.

Changes

Added more strict check for attributes and a test.

Tested on

test on mac, ran testing suite.

Additional information

Closes #6563

AI Disclosure Statement

a coding agent found the cause, wrote the fix and tests, and ran them. i reviewed and tested the app myself.

Declarations

  • I hereby confirm that I am solely responsible for the code provided in
    this PR. Usage of AI to generate code has been documented and made
    transparent. I understand that AI cannot be an author and the commit messages
    do not contain any chatbots or agents as "co-authors". There are no copyright
    issues with my code.
  • I hereby confirm that I wrote this PR description myself and that I did
    not use an LLM to draft this description.
  • I have specified any open issues that this PR fixes/closes accordingly in
    the additional information section.

The Pandoc attributes inline parser treated any {...} as a
PandocAttribute as long as it was preceded by whitespace and was the
last thing on the line, without checking whether the content inside
the braces was actually valid attribute syntax (#id, .class, key=val,
-, =format). A table cell (or paragraph) ending in a literal { ... }
that happened to satisfy the position check, e.g. "One of {Active,
Pending Approval, Removed}", had its braces and everything inside
them silently swallowed.

Add a content validator so the delimiter is only resolved into a
PandocAttribute when the content between the braces is empty or a
valid attribute list; otherwise the braces are left as literal text.

Fixes Zettlr#6563
@boring-cyborg

boring-cyborg Bot commented Sep 18, 2026

Copy link
Copy Markdown

Thank you for opening your first PR. We appreciate the time and effort you spent in creating this improvement. A maintainer will look at these changes shortly, and conduct a review. Please be patient, as everyone here works on this app in their free time. We will get to your PR as soon as we can.
In the meantime, please check that you aid us as much as possible to fast- track your changes by adhering to our Contributing guide and Code of Conduct, and ensuring that your PR is manageable and contains only as many changes as absolutely necessary to expedite review.
Here is a checklist for you to go through as you await our review:

  • Keep your PR up-to-date. We sometimes merge changes into develop that
    then cause merge conflicts. We will not fix those for you, so please ensure
    to merge the develop branch back into your branch to keep it up to date and
    prevent merge conflicts from interfering with the process.
  • Ensure you follow the "human communication" requirement. While we allow
    the use of LLMs for aiding with code, we strictly require every contributor
    to communicate themselves. If you have let your LLM fill in the PR
    description, please use the official pull request template and exchange the
    LLM-generated response with it, filling in the required sections yourself.
  • Check the status of the CI pipeline. Every PR must pass a linter and
    unit tests check. If those run correctly locally on your computer, they
    likely will run fine here. You do not need to fix warnings or errors that
    are clearly not caused by your PR. A failed check does not constitute a hard
    block towards merging your PR.
  • Stay responsive. We will let you know if there are issues with your PR,
    and when we have conducted a code review. Please act on our comments and
    requests in a timely manner. Failure to do so may lead to the closing of
    your PR.

If any of the above is unclear, or if you want to clarify something before jumping into action, please let us know; either with a comment here under your PR, or on the Community Forum or on Discord. We value upfront communication, since this can reduce misunderstandings and improve the efficiency of the work.
Thanks again!

@costajohnt costajohnt changed the title Fix/6563 curly braces table cells fix: keep literal curly braces at end of table cell or line Sep 18, 2026
@benniekiss

benniekiss commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Thank you for the PR!

I will give this a more thorough review shortly, but one thing I noticed is that the pandoc attribute regex could probably be reused from https://github.com/Zettlr/Zettlr/blob/develop/source/common/pandoc-util/parse-pandoc-attributes.ts

EDIT: Also, looking over the linked regex, it seems that two cases are not handled:

  1. single-quoted key/value pairs
  2. Bare {-} attributes, equivalent to {.unnumbered}.

So these should be handled in the regex, and tests should be added to https://github.com/Zettlr/Zettlr/blob/develop/test/parse-pandoc-attributes.spec.ts

@benniekiss benniekiss changed the title fix: keep literal curly braces at end of table cell or line fix: validate pandoc attribute content during parsing Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Curly braces interpretation in WYSIWYG tables

2 participants