Support Pandoc escaped spaces and end-of-block backslash hard breaks#9
Closed
PiotrCzapla wants to merge 1 commit into
Closed
Support Pandoc escaped spaces and end-of-block backslash hard breaks#9PiotrCzapla wants to merge 1 commit into
PiotrCzapla wants to merge 1 commit into
Conversation
Follow Pandoc's escaped_line_breaks/escaped-space rules: backslash
before a space renders a non-breaking space, and a backslash at the
end of a line is a hard break even at the end of a block, so a
paragraph of just "\" renders as <p><br /></p>. This restores the
"\" / "\ " spacer-paragraph authoring convention used in md-to-docx
pipelines.
Also fix a pre-existing bug where an escaped backslash before a
newline ("a\\" + newline) was treated as a hard break instead of a
literal backslash plus soft break.
Four cmark spec examples that assert the CommonMark literal-text
behavior are marked disabled as deliberate dialect deviations,
matching pandoc output exactly in each case.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
This would break prose like We could consider adding an option for each of the two backslash escapes (nbsp and br) if you feel it's important. |
Author
|
Really good example I wasn't aware that windows path would break. I like Let me close this. |
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.
I've added support for a bare
\to represent a newline in Pandoc, and\to represent a non-breaking space.This makes it easy to add vertical space in
.docxfiles by simply adding a few newlines and a backslash, or a backslash followed by a space.This seems to contradict the cmark-gfm specification. I'm not sure what the rationale was for not allowing a trailing backslash to add line breaks, but if we want to adhere to the standard, we can use
<br/>or .Here is an example of contract that uses \ to add spacing around signature blocks: