Skip to content

Commit

Permalink
fix: heading renderer output
Browse files Browse the repository at this point in the history
  • Loading branch information
tcort committed May 4, 2022
1 parent 69252dc commit ce16860
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ module.exports = function markdownLinkExtractor(markdown, extended = false) {

const renderer = {
heading(text, level, raw, slugger) {
anchors.push(`#${this.options.headerPrefix}${slugger.slug(raw)}`);
if (this.options.headerIds) {
var id = this.options.headerPrefix + slugger.slug(raw);
anchors.push(`#${id}`);
return "<h" + level + " id=\"" + id + "\">" + text + "</h" + level + ">\n";
} // ignore IDs


return "<h" + level + ">" + text + "</h" + level + ">\n";
}
};

Expand Down

0 comments on commit ce16860

Please sign in to comment.