Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make any ASCII character escapable #163

Merged
merged 6 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,18 @@ jobs:
- name: Publish Docker image
if: github.ref == 'refs/heads/main'
run: docker push witiko/markdown --all-tags
automerge:
name: Automatically merge pull request
needs:
- test-and-publish
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Automatically merge pull request
uses: plm9606/automerge_actions@1.2.3
with:
label-name: automerge
reviewers-number: 0
merge-method: merge
auto-delete: true
github-token: ${{ secrets.GITHUB_TOKEN }}
14 changes: 8 additions & 6 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -6456,7 +6456,7 @@ defaultOptions.shiftHeadings = 0
% \fi
% \begin{markdown}
%
% \Valitem[\textasciicircum{} \$]{slice}{the beginning and the end of a slice}
% \Valitem[\textasciicircum{} \\$]{slice}{the beginning and the end of a slice}
%
: Two space-separated selectors that specify the slice of a document that
will be processed, whereas the remainder of the document will be ignored.
Expand Down Expand Up @@ -19482,7 +19482,7 @@ parsers.fourspaces = P(" ")
parsers.any = P(1)
parsers.fail = parsers.any - 1

parsers.escapable = S("\\`*_{}[]()+_.!<>#-~:^@;")
parsers.escapable = S("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")
parsers.anyescaped = parsers.backslash / "" * parsers.escapable
+ parsers.any

Expand Down Expand Up @@ -19739,9 +19739,10 @@ parsers.leader = parsers.space^-3

-- content in balanced brackets, parentheses, or quotes:
parsers.bracketed = P{ parsers.lbracket
* ((parsers.anyescaped - (parsers.lbracket
+ parsers.rbracket
+ parsers.blankline^2)
* (( parsers.backslash / "" * parsers.rbracket
+ parsers.any - (parsers.lbracket
+ parsers.rbracket
+ parsers.blankline^2)
) + V(1))^0
* parsers.rbracket }

Expand Down Expand Up @@ -19769,7 +19770,8 @@ parsers.tag = parsers.lbracket
* Cs((parsers.alphanumeric^1
+ parsers.bracketed
+ parsers.inticks
+ (parsers.anyescaped
+ ( parsers.backslash / "" * parsers.rbracket
+ parsers.any
- (parsers.rbracket + parsers.blankline^2)))^0)
* parsers.rbracket

Expand Down
25 changes: 25 additions & 0 deletions tests/testfiles/CommonMark_0.30/backslash-escapes.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<<<
\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~

\→\a\ \3\φ\«
>>>
documentBegin
hash
dollarSign
percentSign
ampersand
backslash
circumflex
underscore
leftBrace
pipe
rightBrace
tilde
interblockSeparator
backslash
backslash
backslash
backslash
backslash
backslash
documentEnd
6 changes: 3 additions & 3 deletions tests/testfiles/PHP_Markdown/php-specific-bugs.test
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ codeSpan: /e
codeSpan: (underscore)UnslashQuotes
interblockSeparator
interblockSeparator
headingOne: Header "quoted(backslash)" again (backslash)""
headingOne: Header "quoted" again (backslash)""
interblockSeparator
headingTwo: Header "quoted(backslash)" again (backslash)""
headingTwo: Header "quoted" again (backslash)""
interblockSeparator
headingThree: Header "quoted(backslash)" again (backslash)""
headingThree: Header "quoted" again (backslash)""
interblockSeparator
codeSpan: (underscore)Detab
interblockSeparator
Expand Down
1 change: 0 additions & 1 deletion tests/testfiles/lunamark-markdown/no-hybrid.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ dollarSign
ulItemEnd
ulItem
backslash
backslash
percentSign
ulItemEnd
ulItem
Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/lunamark-markdown/no-tex-comments.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ documentBegin
codeSpan: texComments
interblockSeparator
emphasis: emphasi(percentSign) this is a comment zed text
emphasis: emphasi(backslash)(percentSign) another one zed text
emphasis: emphasi(percentSign) another one zed text
interblockSeparator
emphasis: end of (backslash) a line
documentEnd