fix: protect tilde-fenced code blocks from strikethrough conversion - #36
Merged
Merged
Conversation
blaipr
force-pushed
the
fix/tilde-fence-strikethrough
branch
from
September 2, 2026 22:39
52db68f to
a204398
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The strikethrough pre-processor in
md_to_confluence_storageprotected fenced code by splitting on```.*?```only. Python-Markdown'sfenced_codeextension also accepts~~~fences and runs longer than three characters, so a~~inside a~~~block (a shell here-doc, Lua's~~, Perl) was rewritten to<del>…</del>inside the code, and ablock containing a literal``` ```` was split at the wrong place.Change
Fences are now found with the same shape the extension uses —
^({3,}|~{3,})opening a line, closed by the identical run at the start of a line — and the text between fences goes through the existing inline-code-aware replacement. The function is split into_replace_strikethrough(fence walk) and_strike_outside_code` (inline spans), with no change to what happens outside fences.Compatibility
Upload only. Backtick fences and inline code behave exactly as before;
~~~fences and 4+-character fences are now left untouched like backtick ones.Checklist
ruff check src tests,ruff format --check src testsandpython -m pytest tests/passtests/test_md_to_storage.py::TestStrikethrough)docs/conversion.md, Code blocks)docs/conversion.mdupdated because an equivalence changedCHANGELOG.mdupdated under Unreleased