Skip to content
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

HeadingPermalinkExtension does not percent-encode CJK names, but commonmark does percent-encode CJK URLs #1021

Open
ptmkenny opened this issue Apr 8, 2024 · 0 comments

Comments

@ptmkenny
Copy link

ptmkenny commented Apr 8, 2024

Version(s) affected

2.4.2

Description

This is an edge case, but when you have a relative link with CJK text and the HeadingPermalinkExtension enabled, then the relative link gets percent-encoded (because Commonmark percent-encodes links), but the name that the relative link is pointing to remains the original CJK text.

This is a minor issue because the link works. However, it can cause automated tests like pa11y to fail because the relative link is pointing to a percent-encoded name, but the name is not percent encoded.

How to reproduce

Here is a link: [Go to summary](#まとめ)

## まとめ

Summary

Produces:

<p>Here is a link: <a href="#%E3%81%BE%E3%81%A8%E3%82%81">Go to summary</a></p>
<h2 name="まとめ">まとめ</h2>
<p>Summary</p>

Possible solution

I know this is a minor issue, but for the sake of consistency I think it would be great to percent-encode the CJK in the names processed by HeadingPermalinkExtension in the same manner as links.

Additional context

Did this project help you today? Did it make you happy in any way?

No response

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

No branches or pull requests

1 participant