Open salmonjean opened 5 years ago
Sure, just pass a function to the slugify
option:
const toc = require('markdown-toc');
const slugify = str => {
// your custom logic here
};
console.log(toc(input, { slugify }));
Is this what you mean?
Also, I published markdown-slug a while ago, for this kind of situation. If you still need to add custom logic with that lib, and you want to do a PR that would be awesome.
Hi
I need a specific slugify function to avoid accentuated and some specials characters. For the moment, I've directly have updated the utils.js source code. It works but it's "not clean". For instance :
str = str.split(/[àèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸçÇßØøÅåÆæœ]/).join('-');
I would rather use your option options.slugify Do you have at least one example to show me how to use this option please? Thanks for your help.
Regards,
Jean