Reputation: 2824
simply if I used this code the extension is working fine
const originalText = '## hello world';
marked.use(gfmHeadingId());
const text = marked.parse(originalText);
console.log('text') // <h2 id="hello-world">hello world</h2>
but if I changed it to
const originalText = '## hello world';
marked.use(gfmHeadingId());
const text = marked.parse(this.originalText, {
renderer: new Renderer(),
});
console.log('text') // <h2>hello world</h2>
it stop working (the h2 doesn't have the id now) how to make both work together?
Upvotes: 0
Views: 167
Reputation: 2824
answer from GitHub https://github.com/markedjs/marked/discussions/3061#discussioncomment-7411454
marked.use({renderer: new Renderer()});
marked.use(gfmHeadingId());
const text = marked.parse(this.originalText)
Upvotes: 0