feat: underline markdown support (#2073)
* fix: no markdown support for underline #2072
This commit is contained in:
@@ -220,6 +220,7 @@ import mdMark from 'markdown-it-mark'
|
||||
import mdFootnote from 'markdown-it-footnote'
|
||||
import mdImsize from 'markdown-it-imsize'
|
||||
import katex from 'katex'
|
||||
import underline from '../../libs/markdown-it-underline'
|
||||
import 'katex/dist/contrib/mhchem'
|
||||
import twemoji from 'twemoji'
|
||||
import plantuml from './markdown/plantuml'
|
||||
@@ -268,6 +269,7 @@ const md = new MarkdownIt({
|
||||
.use(mdAttrs, {
|
||||
allowedAttributes: ['id', 'class', 'target']
|
||||
})
|
||||
.use(underline)
|
||||
.use(mdEmoji)
|
||||
.use(mdTaskLists, {label: true, labelAfter: true})
|
||||
.use(mdExpandTabs)
|
||||
|
12
client/libs/markdown-it-underline/index.js
Normal file
12
client/libs/markdown-it-underline/index.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const renderEm = (tokens, idx, opts, env, slf) => {
|
||||
const token = tokens[idx];
|
||||
if (token.markup === '_') {
|
||||
token.tag = 'u';
|
||||
}
|
||||
return slf.renderToken(tokens, idx, opts);
|
||||
}
|
||||
|
||||
module.exports = (md) => {
|
||||
md.renderer.rules.em_open = renderEm;
|
||||
md.renderer.rules.em_close = renderEm;
|
||||
}
|
Reference in New Issue
Block a user