Skip to content

Fix equation labels, Pandoc ref attributes, and image caption artifacts#2

Merged
samuelduchesne merged 2 commits intomainfrom
claude/build-verify-docs-v25.2.0-YSee0
Feb 24, 2026
Merged

Fix equation labels, Pandoc ref attributes, and image caption artifacts#2
samuelduchesne merged 2 commits intomainfrom
claude/build-verify-docs-v25.2.0-YSee0

Conversation

@samuelduchesne
Copy link
Copy Markdown
Contributor

  • Strip \label{} commands from display math blocks (both before closing $$
    and after opening $$), fixing ~366 occurrences of raw LaTeX labels in
    MathJax equations. Use targeted pattern matching instead of fragile
    $$...$$ block matching to avoid false matches from adjacent inline math.
  • Strip Pandoc {reference-type="ref" reference="..."} attribute spans
    (~476 occurrences) and unescape bracket notation in ref link text.
  • Clean empty [] bracket artifacts in image alt text (~11 occurrences).

https://claude.ai/code/session_01AxQpFdDAmHAXuZcjgjjGiC

- Strip \label{} commands from display math blocks (both before closing $$
  and after opening $$), fixing ~366 occurrences of raw LaTeX labels in
  MathJax equations. Use targeted pattern matching instead of fragile
  $$...$$  block matching to avoid false matches from adjacent inline math.
- Strip Pandoc {reference-type="ref" reference="..."} attribute spans
  (~476 occurrences) and unescape bracket notation in ref link text.
- Clean empty [] bracket artifacts in image alt text (~11 occurrences).

https://claude.ai/code/session_01AxQpFdDAmHAXuZcjgjjGiC
Replace the single-pass regex-based bracket macro expansion with a
recursive stack-based approach that properly handles arbitrary brace
nesting depth. The old regex could only match one level of nested
braces, leaving macros like \PB{\frac{\dot{m}_{a}}{\dot{m}_{b}}}
unexpanded (21 occurrences across 8 files). The new implementation
uses a brace-counting parser that recursively expands inner macros
first, eliminating all remaining instances.

https://claude.ai/code/session_01AxQpFdDAmHAXuZcjgjjGiC
@samuelduchesne samuelduchesne merged commit 08ebf5d into main Feb 24, 2026
2 checks passed
@samuelduchesne samuelduchesne deleted the claude/build-verify-docs-v25.2.0-YSee0 branch February 24, 2026 01:53
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5272e10bb0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

text = re.sub(r"(\$\$)\\label\{[^}]+\}\s*", r"\1", text)
# Strip <a id="..."></a> anchors inside equation blocks
# These appear on a line between $$ markers
text = re.sub(r'(<a id="[^"]+"></a>)\s*\n\n\$\$', "\n$$", text)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve equation anchors before display-math blocks

clean_equation_labels now removes any <a id="..."></a> followed by \n\n$$, but RawBlock in scripts/pandoc_filters/energyplus.lua intentionally emits labeled equations/align blocks in exactly that form (<a id="label"></a>\n\n$$...). This strips the only in-page anchor for equation labels, so references that end up as (#label) (including the links normalized by clean_pandoc_ref_attributes) become dead links for labeled equations.

Useful? React with 👍 / 👎.

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.

2 participants