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

Support both upstream CommonMark and GFM's differences in the base spec. #428

Merged
merged 14 commits into from
Jul 10, 2024

Conversation

kivikakk
Copy link
Owner

@kivikakk kivikakk commented Jul 10, 2024

Fixes #329.

WIP; I think there's some CommonMark revisions to catch up on.

  • Example 28 (lines 690-700) Entity and numeric character references
  • Example 354 (lines 6347-6357) Emphasis and strong emphasis
  • Example 540 (lines 8129-8135) Links

This brings us to CommonMark 0.31.2.

Copy link
Contributor

github-actions bot commented Jul 10, 2024

Command Mean [ms] Min [ms] Max [ms] Relative
./bench.sh ./comrak-09f7188 323.0 ± 2.2 320.2 329.0 2.94 ± 0.03
./bench.sh ./comrak-main 322.3 ± 2.8 320.1 333.6 2.93 ± 0.03
./bench.sh ./pulldown-cmark 109.9 ± 0.6 108.8 111.3 1.00
./bench.sh ./cmark-gfm 119.1 ± 2.4 117.2 127.6 1.08 ± 0.02
./bench.sh ./markdown-it 485.3 ± 12.8 475.1 541.7 4.41 ± 0.12

Run on Wed Jul 10 17:09:09 UTC 2024

We add `caseless` to do the folding. It matches upstream enough [^1],
unlike e.g. ICU4X's `CaseMapper` (doesn't fold Eszett to "ss"), and also
unlike ICU4X, it doesn't require us to bump our MSRV. 2/2 sgtm

A separate `--gfm-quirks` CLI option is added since base tests fail if
we just turn on all of GFM for them.

The nice thing about `caseless` is that while its last release may be
6 years ago, it depends on unicode-normalization ^0.1, the latest of
which is 5 months ago. It's also [very easy to read][caseless], so I'm
all good with this.

[^1] Not that straightforward: commonmark/commonmark-spec#695

[caseless]: https://github.com/unicode-rs/rust-caseless/blob/v0.2.1/src/lib.rs
@kivikakk kivikakk marked this pull request as ready for review July 10, 2024 15:43
@kivikakk
Copy link
Owner Author

/run-bench

@digitalmoksha
Copy link
Collaborator

Whoa, cool! 🚀

@kivikakk kivikakk enabled auto-merge July 10, 2024 17:21
@kivikakk kivikakk merged commit eaf3ad3 into main Jul 10, 2024
39 checks passed
@kivikakk kivikakk deleted the commonmark-gfm branch July 10, 2024 17:23
@gjtorikian
Copy link
Collaborator

Thank you! :)

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.

Need link to spec in readme + document deviations
3 participants