Skip to content

Fix code cells shown as raw "```mathematica" text (76 pages) - #28

Open
tombouctou wants to merge 1 commit into
FeynCalc:masterfrom
tombouctou:fix-code-fences
Open

tombouctou wants to merge 1 commit into
FeynCalc:masterfrom
tombouctou:fix-code-fences

Conversation

@tombouctou

@tombouctou tombouctou commented Oct 19, 2026 •

Copy link
Copy Markdown

At the bottom of e.g. QED/TwoLoops/Renormalization-LeAle the last code cell is shown as a paragraph of raw text: ```mathematica FCCompareResults[leptonSE$RenConstants2L, knownResult, Text -> {“to Grozing, … followed by a stray ```mathematica.

Cause

FeynCalc/Documentation/Scripts/cleanUpMarkdown.sh labels code cells with

sed -z -i -e 's|\n\n```\n|\n\n```mathematica\n|g' $1;

which is meant for opening fences, but a closing fence that follows an empty line (a cell ending in a blank line) matches too. The cell is then "closed" by ```mathematica, which opens a new block instead, and pandoc renders the cell as a paragraph of raw text — or, in TID and UnDeclareNonCommutative, swallows the output after it into the code block.

What this PR changes

76 pages: 52 in FeynCalcExamples, 11 in FeynCalcBook, 13 in FeynCalcBookDev (FeynHelpersBookDev is not affected). No other page contains a stray fence afterwards.

Each page was regenerated with the pandoc command of generateHTML.sh (same template and Lua filter) from its Markdown source with the relabelled closing fence put back to ``` — master for FeynCalcBookDev and the examples, hotfix-stable for FeynCalcBook, and for ten examples no longer in master (e.g. QED/OneLoop/El-El, QCD/OneLoop/Q-Q; not linked from the gallery any more) the last version before they were removed. Only the broken region was taken over from the result; everything else in each page is unchanged byte for byte, so differences between pandoc versions and later edits of the sources do not leak in. Checked: no ``` left in any page, <div>s balanced, no duplicate code-block ids.

The source

The script fix and the affected Markdown files (56 on master, 54 on hotfix-stable) are in FeynCalc/feyncalc#370 (master) and FeynCalc/feyncalc#371 (hotfix-stable) — the sed rule is replaced by an awk pass that labels only opening fences. Without it the next regeneration of the manuals brings the broken cells back.

Kept separate from the search PR so that it can be reviewed on its own.

🤖 Generated with Claude Code

In the Markdown the manuals and the example gallery are generated from,
a code cell that ends with an empty line has its closing fence turned into
"```mathematica" by Documentation/Scripts/cleanUpMarkdown.sh: the rule

    sed -z 's|\n\n```\n|\n\n```mathematica\n|g'

is meant to label opening fences, but a closing fence preceded by a blank
line matches it too. The fence then opens instead of closing, and pandoc
renders the cell as a paragraph of raw text ("```mathematica
FCCompareResults[...] ...") or swallows the output that follows into the
code block (TID, UnDeclareNonCommutative).

Affected: 52 example pages (e.g. QED/TwoLoops/Renormalization-LeAle, at
the bottom), 11 pages of the stable manual, 13 of the development manual.

Each page was regenerated with the generateHTML.sh pandoc command from
its Markdown source with the relabelled closing fence put back to "```"
(master for FeynCalcBookDev and the examples, hotfix-stable for
FeynCalcBook, the last version before removal for ten examples whose
source is gone from master). Only the broken region was taken over from
the result; the rest of each page is unchanged byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant