Inject attributes into markup tags.
camerondunford opened this issue · comments
Cameron Dunford commented
Is it possible to add tags to markup elements?
For example, adding target="_blank"
to anchor tags:
_linkTargetBlank(mobiledoc) {
let markups = mobiledoc.sections[0] || [];
// new anchor markup sections
let newMarkups = markups.map(markup => {
// skip everything but anchors
if (markup[0] !== 'a') {
return markup;
}
markup.pushObject(['target', '_blank']);
return markup;
});
// replace markup sections
mobiledoc.sections[0] = newMarkups;
return mobiledoc;
},
Matthew Beale commented
Customizing the rendering of markups is not supported today, though Garth and I have discussed it.
If you want to use target blank, I suggest using JavaScript to capture the clicks on links and open windows that way.
Cameron Dunford commented
It would be a welcome feature. Thank you for your response & suggested workaround.