Skip to content

Keep nested emphasis around a bare URL from becoming strong emphasis - #20128

Open
HuzaifaChaudary wants to merge 1 commit into
prettier:mainfrom
HuzaifaChaudary:fix/markdown-autolink-emphasis
Open

HuzaifaChaudary wants to merge 1 commit into
prettier:mainfrom
HuzaifaChaudary:fix/markdown-autolink-emphasis

Conversation

@HuzaifaChaudary

Copy link
Copy Markdown

Description

fixes #8654

an emphasis that starts with a bare url keeps the delimiter it was written with , since changing it next to a url can change where the url ends . the emphasis around it did not know that and picked _ too , so *_https://example.com_* came out as __https://example.com__ , which is strong emphasis , and the next run turned it into **https://example.com** . now the outer one keeps its written delimiter as well , so the input comes back as it was .

the auto-link test had 24 nested wrappers commented out . 18 of them pass now and are turned back on , 4 of their cases fail without this change and the rest already passed on main . the other 6 still fail on main for a different reason , a literal _ or * right next to the url that is not a delimiter , so they stay commented out . the issue case is pinned in emphasis/issue-8654.md .

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.
  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

Copilot AI lite review requested due to automatic review settings September 22, 2026 00:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

an emphasis that starts with an autolink keeps the delimiter it was written
with . the emphasis around it did not know that and picked `_` too , so
`*_https://a.b_*` came out as `__https://a.b__` , which is strong emphasis ,
and the next format turned it into `**https://a.b**` . the parent now keeps
its written delimiter as well .

the issue case is pinned in emphasis/issue-8654.md . 18 of the 24 nested
wrappers commented out in the auto-link test pass now and are turned back on ,
4 of their cases fail on main . the other 6 wrappers still fail the same way
on main for a different reason and stay commented out .

Co-Authored-By: Claude Opus 5 <[email protected]>
@HuzaifaChaudary
HuzaifaChaudary force-pushed the fix/markdown-autolink-emphasis branch from 59f7dde to d45a881 Compare September 22, 2026 00:06
@netlify

netlify Bot commented Sep 22, 2026

Copy link
Copy Markdown

✅ Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 59f7dde
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/6ab1c68db186a00008515e87
😎 Deploy Preview https://deploy-preview-20128--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 22, 2026

Copy link
Copy Markdown

✅ Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit d45a881
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/6ab1c69750d3b3000824ebd4
😎 Deploy Preview https://deploy-preview-20128--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unstable autolink format after #8630

2 participants