Skip to content

Conversation

@smikitky
Copy link
Member

@smikitky smikitky commented Nov 15, 2025

This fixes #8140.

With this change, contents in <TerminalBlock> will no longer be processed by SmartyPants. Previously, -- was converted to en-dashes, so --save-dev looked 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):

image

After:

image

Change summary

  • Edited the remark-smartypants.js plugin so that it no longer transforms <TerminalBlock> content. This is done by tagging its subtrees with data.skipSmartyPants and bailing out before running the typography pass.
  • Render TerminalBlock output with <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.
  • Clean up every existing TerminalBlock usage by stripping the hacky {`…`} workaround
  • Bump DISK_CACHE_BREAKER

@github-actions
Copy link

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 127.9 KB (🟡 +13 B) 238.44 KB
/500 127.91 KB (🟡 +13 B) 238.45 KB
/[[...markdownPath]] 130.34 KB (🟡 +13 B) 240.88 KB
/errors 128.15 KB (🟡 +13 B) 238.69 KB
/errors/[errorCode] 128.13 KB (🟡 +13 B) 238.67 KB
Details

Only 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 next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

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.

@smikitky
Copy link
Member Author

@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?

@gaearon gaearon merged commit 2534424 into reactjs:main Nov 15, 2025
8 checks passed
@smikitky smikitky deleted the fix/smartypants branch November 15, 2025 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SmartyPants replaces -- into an em-dash in <TerminalBlock>

2 participants