fix: Stop SmartyPants from altering TerminalBlock commands (like --save-dev to —save-dev)
#8146
+40
−20
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.
This fixes #8140.
With this change, contents in
<TerminalBlock>will no longer be processed by SmartyPants. Previously,--was converted to en-dashes, so--save-devlooked like—save-dev(with an en-dash) unless each snippet was manually escaped using a hacky and nonintuitive syntax. This PR will prevent this type of bugs once and for all for contributors.Before (current problem in https://react.dev/learn/typescript):
After:
Change summary
remark-smartypants.jsplugin so that it no longer transforms<TerminalBlock>content. This is done by tagging its subtrees withdata.skipSmartyPantsand bailing out before running the typography pass.<pre><code>instead of relying on generic<div>wrappers. This was not strictly necessary to fix the current bug, but I believe it's desirable.{`…`}workaroundDISK_CACHE_BREAKER