I have a markdown string contains some Chinese like this:
# 中文English中文
use marked I got this:
<h1 id="-Englist-">中文English中文</h1>
````
I wish I cloud get this:
```
id attribute in headings (h1,h2,h3,etc) is not show in the right way
Related: #1280
It looks like github-slugger could be used to solve this issue too.
I also encountered this problem, try custom renderer
const renderer = new marked.Renderer();
renderer.heading = (text, level, raw) => {
const id = raw.toLowerCase().replace(/[^a-zA-Z0-9\u4e00-\u9fa5]+/g, '-');
return `<h${level} id=${id}>${text}</h${level}>\n`;
};
const result = marked(src, { renderer });
@jinasonlin
It works!Thank you!
Closing as resolved.
Most helpful comment
I also encountered this problem, try custom
renderer