dart-lang / markdown

A Dart markdown library
https://pub.dev/packages/markdown
BSD 3-Clause "New" or "Revised" License
450 stars 201 forks source link

Fix unicode case folding #465

Closed chenzhiguang closed 2 years ago

chenzhiguang commented 2 years ago

This PR simply implements the Unicode Case folding on normalizeLinkLabel function.

See https://spec.commonmark.org/0.30/#link-label

To normalize a label, strip off the opening and closing brackets, perform the Unicode case fold, strip leading and trailing spaces

This PR also includes a script to generate the caseFoldingMap.

Also I have created an assets folder, my idea is to put these generated files together in this folder, now we have emojis.dart and case_folding.dart. There will be an html_entities.dart file later soon. If you agree with it, I will create another PR to move emojis.dart into it.

chenzhiguang commented 2 years ago

Hi @srawlins! How about this one?

kevmoo commented 2 years ago

LGTM, but @srawlins should also give his blessing!

chenzhiguang commented 2 years ago

Screenshot 2022-10-06 at 21 20 08

Now it is slightly better

srawlins commented 2 years ago

Haha it seems nearly 0 performance change. 🎉