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

Simplify anchorize() #297

Merged
merged 1 commit into from
Apr 11, 2023
Merged

Simplify anchorize() #297

merged 1 commit into from
Apr 11, 2023

Conversation

kornelski
Copy link
Contributor

Fewer string copies.

This function could be simplified further, but I'm surprised that it's not using the slug crate, which is already a dependency of comrak.

@kivikakk
Copy link
Owner

This function could be simplified further, but I'm surprised that it's not using the slug crate, which is already a dependency of comrak.

I almost didn't notice that happen! It crept in just for an example, recently (fc6502b). Anchorizer mimics the exact output of GitHub's own slug generation, which is why it doesn't use any crate.

@kivikakk kivikakk enabled auto-merge April 11, 2023 23:51
@kivikakk kivikakk merged commit 2cac9d0 into kivikakk:main Apr 11, 2023
@kivikakk
Copy link
Owner

Thank you! 🤍

@vadimkantorov
Copy link

@kivikakk Does GitHub actually use this anchorize() in production to slugify? or is it a somewhat outdated reverse-engineered attempt?

@kivikakk
Copy link
Owner

@vadimkantorov at the time of writing, it matched the actual implementation behaviour exactly (which I also maintained), but Comrak wasn't used by GitHub.

Whether it is now -- they've invested some developer time and sponsorship in it, but that's all I know -- or whether it still matches, I couldn't say.

@vadimkantorov
Copy link

vadimkantorov commented Mar 26, 2024

Interesting, thank you!

https://github.com/github/markup?tab=readme-ov-file#markups refers to https://github.com/gjtorikian/commonmarker which is a ruby wrapper of https://github.com/kivikakk/comrak which is a rust port of https://github.com/github/cmark-gfm/

So maybe comrak is indeed used by GH?

So I wondered if this slug generation lives in comrak or is also implemented in cmark-gfm?

@gjtorikian
Copy link
Collaborator

Feel free to contact GitHub Support, they would know best about what they are currently using in production: http://github.com/support

@vadimkantorov
Copy link

vadimkantorov commented Mar 26, 2024

Sure, thanks for the tip, in the meanwhile I also asked at https://github.com/orgs/community/discussions/114288, will contact the support as well (although it seems that this discussions section is the only way to talk about these questions with GitHub)

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.

4 participants