Modrinth/plugins/markdown.js
Geometrically b4236b9a95
Fix duplicate version nums + etc (#831)
* Fix duplicate version nums + etc

* Update link info

* Remove useless loading conditions

* Update pages/legal/privacy.vue

Co-authored-by: triphora <emmaffle@modrinth.com>

* Update plugins/xss.js

Co-authored-by: triphora <emmaffle@modrinth.com>

Co-authored-by: triphora <emmaffle@modrinth.com>
2023-01-03 19:06:30 -07:00

24 lines
561 B
JavaScript

import MarkdownIt from 'markdown-it'
export default (ctx, inject) => {
const md = new MarkdownIt('default', {
html: true,
linkify: true,
breaks: false,
})
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].attrJoin('rel', 'noopener noreferrer ugc')
return defaultRender(tokens, idx, options, env, self)
}
inject('md', md)
}