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

Do not escape tildes in safe constructs that are nested in unsafe constructs #2

Merged
merged 3 commits into from
Nov 4, 2022
Merged

Do not escape tildes in safe constructs that are nested in unsafe constructs #2

merged 3 commits into from
Nov 4, 2022

Conversation

bertramakers
Copy link
Contributor

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

Fix for the issue described in remarkjs/remark-gfm#42

I've first added tests to prove that tildes are in fact being escaped in some safe constructs like link URLs (among others). See the results here: https://github.com/bertramakers/mdast-util-gfm-strikethrough/actions/runs/3394305801

Results with the code fix: https://github.com/bertramakers/mdast-util-gfm-strikethrough/actions/runs/3394322969

Tests & code are heavily based on syntax-tree/mdast-util-to-markdown@7b381da so credits go to @wooorm for doing the heavy lifting before and sharing how to fix this.

Note that the safe constructs must be wrapped by an unsafe construct like a paragraph or heading, because gfmStrikethroughToMarkdown will only escape them inside constructs where strikethroughs can be used (ie paragraphs and headings).
@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Nov 4, 2022
index.js Show resolved Hide resolved
@wooorm wooorm merged commit 98a14b4 into syntax-tree:main Nov 4, 2022
@github-actions

This comment has been minimized.

@wooorm wooorm added the 💪 phase/solved Post is done label Nov 4, 2022
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Nov 4, 2022
@wooorm
Copy link
Member

wooorm commented Nov 4, 2022

@bertramakers bertramakers deleted the do-not-escape-tildes-in-safe-constructs branch November 7, 2022 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done
Development

Successfully merging this pull request may close these issues.

2 participants