wiki/editor/src/markdown.js
Peter Stuifzand 5cc4e65638
All checks were successful
continuous-integration/drone/push Build is passing
Add blocks backend
2020-10-21 20:49:23 +02:00

26 lines
662 B
JavaScript

import MarkdownIt from "markdown-it";
import MarkdownItWikilinks from "./wikilinks";
import MarkdownItMark from "markdown-it-mark";
import MarkdownItKatex from "markdown-it-katex";
const MD = new MarkdownIt({
linkify: true,
highlight: function (str, lang) {
if (lang === 'mermaid') {
return '<div class="mermaid">' + str + '</div>';
}
return '';
}
})
MD.use(MarkdownItWikilinks({
baseURL: document.querySelector('body').dataset.baseUrl,
uriSuffix: '',
relativeBaseURL: '/edit/',
htmlAttributes: {
class: 'wiki-link'
},
})).use(MarkdownItMark).use(MarkdownItKatex)
export default MD;