hiro0218 / mokuji.js

generate "table of contents".
https://www.npmjs.com/package/mokuji.js
MIT License
5 stars 1 forks source link

Duplicate anchor link when I use same name header. #15

Open gamerinshaft opened 6 years ago

gamerinshaft commented 6 years ago
2018-01-22 14 10 21

I resolved this problem by adding this code:

mokuji.js line 181

180     var textContent = this.censorshipId(node.textContent);
181     node.id = this.censorshipId(node.id);  // I added this code :D
182
183     // add to wrapper
184     node.id = this.setAnchor(node.id, textContent, options.anchorType);
185     ol.appendChild(this.buildList(node, a.cloneNode(false), li.cloneNode(false)));
2018-01-22 14 19 47

It's working without bug, but there may be better way.

plz check it out πŸ‘

hiro0218 commented 6 years ago

おηŸ₯γ‚‰γ›γ‚γ‚ŠγŒγ¨γ†γ”γ–γ„γΎγ™οΌπŸ™ 処理を璺θͺζ¬‘η¬¬γ€ε‚θ€ƒγ«γ•γ›γ¦γ„γŸγ γγΎγ™οΌ

gamerinshaft commented 6 years ago

LGTM