redbug312/markdown-it-multimd-table

[Feature Request] Add option to customize id generation rule

Opened this issue · 2 comments

https://github.com/RedBug312/markdown-it-multimd-table/blob/2570107cbf7c595057156cece284f1c8e468d40b/index.js#L61

This rule makes all title with no ascii alphabets to have an empty id, which makes it hard to refrence them.

For example
图片

In markdown-it-anchor, such option named slugify.

Thanks for the report. I was waiting for upstream updates for consistent slugify implementation.
However it seems the issue still remains open for conflicts and compatibility problems.

Option slugify can be configured now in branch customize-slugify. It'll be released as v4.1.0.
Default one won't be replaced until v5.0.0, into this line in markdown-it-anchor (without incremented counters)
Recommended to assign it to the option, for future compatibility.

const slugify = (s) => encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, '-'))