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

Additional support for custom options.slugger #18

Closed
wants to merge 2 commits into from

Conversation

agrohs
Copy link

@agrohs agrohs commented Mar 11, 2023

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

This adds new support for an additonal option containing a custom slugger implementation. By default it still uses the "built in" (opinionated) github-slugger but also supports your own customer slugger:

This could be another popular third party package such as slugify and/or your own custom implementation.

Ex usage (custom slugger):

  rehype()
    .data('settings', {fragment: true})
    .use(rehypeSlug, {
      slugger: {
        slug: (_value) =>
          `test--${_value.replace(/\W/g, '').toLowerCase()}--test`
      }
    })

Ex usage (making uses of slugify):

  rehype()
    .data('settings', {fragment: true})
    .use(rehypeSlug, {
      prefix: 'prefix--',
      slugger: {
        slug: slugify,
        // Can be used with custom options such as:
        // slug: (_value) => slugify(_value, {lower: true, strict: true, replacement: '__'})
      }
    })

Related to #16
Closes #17

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Mar 11, 2023
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1c61632) 100.00% compared to head (a5e93e5) 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #18   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           37        65   +28     
=========================================
+ Hits            37        65   +28     
Impacted Files Coverage Δ
index.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@wooorm
Copy link
Member

wooorm commented Mar 11, 2023

Eh, I’ll close this. Again: thanks but no thanks.
You asked if a PR would be accepted, I said no, and then you made a PR. So… that’s not going to be accepted.

@wooorm wooorm closed this Mar 11, 2023
@wooorm wooorm added the 🙅 no/wontfix This is not (enough of) an issue for this project label Mar 11, 2023
@github-actions

This comment has been minimized.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Mar 11, 2023
@agrohs
Copy link
Author

agrohs commented Mar 11, 2023

FIgured the code would likely be helpeful for others even though your earlier comment appears dismissive and against the intent of most open source projects (and your own code of conduct)

@agrohs
Copy link
Author

agrohs commented Mar 11, 2023

@RichardLitt and/or Olivia Hugger I'd love to chat any time offline on the interaction in the community here.

@RichardLitt
Copy link
Member

Sure, @agrohs. My email is not hard to find (see my profile). Apologies for not understanding your LinkedIn connection until now - feel free to drop me a line.

@agrohs
Copy link
Author

agrohs commented Mar 11, 2023

Will do, thanks @RichardLitt - I'll shoot you an email direct!

@RichardLitt
Copy link
Member

RichardLitt commented Mar 11, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on
Development

Successfully merging this pull request may close these issues.

Why not support a pluggable option.slug function (or options.slugger implementation)?
4 participants