-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Ampersand in link query strings unexpectedly escaped with backslash #1196
Comments
Hey! This is intentional.
The link is not broken. Markdown parsers support escapes. For more info, see for example syntax-tree/mdast-util-to-markdown#53. |
This comment has been minimized.
This comment has been minimized.
Thanks for the response! |
No worries! Could you share the actual problem with me? I'd appreciate hearing your root cause for future strugglers! |
Mostly human error! 😅 We have a pipeline that pulls in some Markdown, processes with remark and a bunch of plugins, and then stores the resulting Markdown for rendering later. We were struggling with migrating some links where the search parameter syntax had changed and noticed “Oh there’s this Anyway — appreciate your fast response. Helped get us back on track 💜 |
Initial checklist
Affected packages and versions
remark@14.0.3 — also tested with 13.0.0, 14.0.0, and 14.0.2 with the same results.
Link to runnable example
https://codesandbox.io/s/remark-ampersand-escaping-repro-6mm6xg
Steps to reproduce
Create a Markdown string, containing a link with a query string. For example:
Process the string with remark:
Inspect the result:
Expected behavior
The original link and query string should remain unchanged.
Actual behavior
The
&
in the link’s query string is escaped with a\
, breaking the link. (Perhaps this is intentional for a reason I don’t understand, but it was unexpected to me.)Runtime
Node v16, v18, v20
Package manager
npm 8, pnpm
OS
Linux, macOS
Build and bundle tools
Rollup, esbuild, Parcel, Vite — tried a bunch of different environments to confirm behaviour.
The text was updated successfully, but these errors were encountered: