Skip to content

Docu (hotfix-stable): cleanUpMarkdown.sh turned closing code fences into opening ones - #371

Open
tombouctou wants to merge 1 commit into
FeynCalc:hotfix-stablefrom
tombouctou:fix-closing-fences-stable
Open

tombouctou wants to merge 1 commit into
FeynCalc:hotfix-stablefrom
tombouctou:fix-closing-fences-stable

Conversation

@tombouctou

Copy link
Copy Markdown

Documentation/Scripts/cleanUpMarkdown.sh labels code cells as Mathematica with

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

The pattern is meant for opening fences, but it also matches a closing fence that follows an empty line, i.e. a cell whose last line is blank. Such a cell is then "closed" by ````mathematica`, which opens a new block instead. pandoc renders the cell as a paragraph of raw text (see the bottom of QED/TwoLoops/Renormalization-LeAle: "```mathematica FCCompareResults[leptonSE$RenConstants2L, …"), or, in TID and UnDeclareNonCommutative, pulls the output that follows into the code block.

Changes

  • cleanUpMarkdown.sh: the sed -z rule is replaced by an awk pass that tracks whether it is inside a cell and labels only opening fences. As before, it does so only for a bare ````` after an empty line. Closing fences are left alone.
  • 54 Markdown files of hotfix-stable already affected get their closing fence back: inside a cell, a ````mathematica` line becomes `````. Nothing else in them changes; each file has a one-line diff.

Verification

  • The repair is idempotent over the whole tree: running it again changes nothing.
  • pandoc renders none of the 54 files with a stray `````.
  • The rendered code-block count goes up by exactly one where a cell had been swallowed, e.g. TID, LeAle, Renormalization2, UnDeclareNonCommutative.
  • The new rule was tested on a small file with a cell ending in a blank line, a labelled opening fence, an unlabelled opening fence after text, and an unlabelled opening fence after an empty line.
  • Rendering LeAle through generateHTML.sh's pandoc command (template + md2html.lua) gives a proper code block where the website currently shows raw text.

Same change as #370 (master), on hotfix-stable: its Markdown differs from master in places, so the repair was rerun on this branch instead of cherry-picking (a cherry-pick conflicts). The stable manual on the website (FeynCalcBook) is built from this branch.

The website side, where the already generated HTML of 76 pages is fixed, is FeynCalc/feyncalc.github.io#28.

🤖 Generated with Claude Code

…ning ones

The rule that labels code cells as Mathematica,

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

also matched a closing fence that follows an empty line (a cell ending in
a blank line), so the cell was closed by "```mathematica" - which opens a
new block instead. pandoc then renders the cell as a paragraph of raw text
("```mathematica FCCompareResults[...]") or swallows the output after it
into the code block (TID, UnDeclareNonCommutative).

The rule is replaced by an awk pass that tracks whether it is inside a cell
and labels only opening fences (still only after an empty line, as before),
and the 54 Markdown files of hotfix-stable already affected get their
closing fence back. Same change as on master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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