fix: Stop SmartyPants from altering TerminalBlock commands (like --save-dev to —save-dev)#8146
Conversation
Size changesDetails📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 Five Pages Changed SizeThe following pages changed size from the code in this PR compared to its base branch:
DetailsOnly the gzipped size is provided here based on an expert tip. First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If Any third party scripts you have added directly to your app using the Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this. |
|
@rickhanlonii Looks like you were the last person to review the code in this area (in #6523). Could you take a look at this as well? |
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