mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-18 14:01:12 +00:00
12 lines
No EOL
504 B
JavaScript
12 lines
No EOL
504 B
JavaScript
export default function formatLink(md, opts) {
|
|
const defaultRender = md.renderer.rules.link_open || function(tokens, idx, options, env, self) {
|
|
return self.renderToken(tokens, idx, options);
|
|
};
|
|
|
|
md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
|
|
tokens[idx].attrPush(['target', '_blank']); // add new attribute
|
|
tokens[idx].attrPush(['class', 'msg-link']);
|
|
// pass token to default renderer.
|
|
return defaultRender(tokens, idx, options, env, self);
|
|
};
|
|
} |