Not adding attribute in TypeScript app
thdoan opened this issue · 1 comments
thdoan commented
Here is my code:
import MarkdownIt from 'markdown-it';
import markdownitLinkAttributes from 'markdown-it-link-attributes';
...
const md = new MarkdownIt();
md.use(markdownitLinkAttributes, {
target: '_blank',
});
md.render('[test](https://www.google.com/)');
// Returns <a href="https://www.google.com/">test</a>
Can someone please point out what I'm doing wrong, or is this plugin not compatible with ES6 import + TypeScript?
crookedneighbor commented
This bit:
md.use(markdownitLinkAttributes, {
target: '_blank',
});
Should be:
md.use(markdownitLinkAttributes, {
attrs: {
target: '_blank',
},
});