Repository navigation
Enhancement (configuration): Add keepescape mode 4 to repair Pandoc escapes - #217
Open
klangme1ster wants to merge 1 commit into
Conversation
…scapes
OneNote pages often start paragraphs with a literal '- ' or '7.'. Pandoc
escapes them ('\- item', '7\. item'), so the notes lose their lists and
carry loose blank lines, line-end backslashes and needless escapes. The
existing modes cannot fix that: 1 deletes every backslash (also in Windows
paths), 2 and 3 keep the list escapes.
Mode 4 (Repair-MarkdownEscapes) rebuilds those lists (also inside block
quotes and after non-breaking spaces), turns a line-end backslash into two
spaces, and removes only escapes that cannot change the rendering. Code
fences and inline code are untouched. Modes 1 to 3 and the default are
unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011zGMypgzLxRQFiU563LLb5
klangme1ster
added a commit
to klangme1ster/ConvertOneNote2MarkDown
that referenced
this pull request
Nov 1, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011zGMypgzLxRQFiU563LLb5
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.
OneNote pages often start paragraphs with a literal
-or7.instead of using real lists. Pandoc escapes such text so it does not turn into a list (\- item,7\. item). In an export of two notebooks (393 pages) this left the notes with plain paragraphs instead of lists, a blank line between every item, a literal\at the end of many lines (Pandoc's hard line break) and many needless escapes (--\>,snake\_case).The existing
keepescapemodes cannot fix this:1deletes every backslash (also in Windows paths such asC:\Program Files),2and3keep the list escapes.This PR adds
keepescape = 4, implemented as the functionRepair-MarkdownEscapes, run on Pandoc's output before the existing replacements:\- itemand7\. item(also inside block quotes and when a non-breaking space follows the marker), removes the blank lines between list items, and drops lone-lines (empty bullets, or an accidental heading underline).\at the end of a line into two trailing spaces, or drops it at the end of a paragraph.\>in--\>,\_insnake\_case,\.and\-in the middle of a line).\[,\],\*pairs,\, Windows and UNC paths.The default (
1) and modes 1 to 3 are unchanged. A literal-at the start of a line is treated as a list in mode 4; use3if that is not wanted.Tested
\*, code), block quotes, non-breaking spaces, running it twice gives the same result, and that mode 4 adds no replacement that touches backslashes..docxfiles, mode 3 against mode 4): escaped bullets 601 to 0, blank lines between list items 67 to 0, line-end backslashes 1804 to 0, lone-lines 29 to 0, escaped numbers 133 to 0. The letters and digits of every page are identical in both modes, so no text is lost.masteron a German Windows.🤖 Generated with Claude Code