优化公式支持mbox cont.
This commit is contained in:
parent
b1257fa647
commit
19606389b6
|
|
@ -230,12 +230,12 @@ const kateX = {
|
|||
try {
|
||||
renderString = renderToString(token.text, {
|
||||
displayMode: token.displayMode,
|
||||
macros: {
|
||||
"\\mbox": "\\text{#1}",
|
||||
"\\textrm": "\\text{#1}",
|
||||
"\\textnormal": "\\text{#1}",
|
||||
},
|
||||
trust: false
|
||||
macros: {
|
||||
"\\mbox": "\\text{#1}",
|
||||
"\\textrm": "\\text{#1}",
|
||||
"\\textnormal": "\\text{#1}",
|
||||
},
|
||||
trust: false
|
||||
})
|
||||
} catch (error) {
|
||||
renderString = `<p style="color:#cc0000" title="${ error.message }">${ token.raw }`
|
||||
|
|
|
|||
|
|
@ -99,13 +99,18 @@ export default ({
|
|||
rs = rs.split(`<a href="`+`/${owner}/${projectsId}/issues/${item.project_issues_index}`+`">#${item.project_issues_index}</a>`).join(content);
|
||||
}
|
||||
}
|
||||
// rs = rs.replace(/(__special_katext_id_\d+__)/g, (_match, capture) => {
|
||||
// const { type, expression } = math_expressions[capture];
|
||||
// return renderToString(_unescape(expression) || '', { displayMode: type === 'block', throwOnError: false, output: 'html' })
|
||||
// })
|
||||
// rs = dompurify.sanitize(rs.replace(/▁/g, "▁▁▁"))
|
||||
// rs = rs.split('<img ').join(`<img onerror="javascript:this.src='${ imgError }';"`) // 替换replaceall
|
||||
// resetMathExpressions()
|
||||
rs = rs.replace(/(__special_katext_id_\d+__)/g, (_match, capture) => {
|
||||
const { type, expression } = math_expressions[capture];
|
||||
return renderToString(_unescape(expression) || '', { displayMode: true, throwOnError: false,macros: {
|
||||
"\\mbox": "\\text{#1}",
|
||||
"\\textrm": "\\text{#1}",
|
||||
"\\textnormal": "\\text{#1}",
|
||||
},
|
||||
trust: false})
|
||||
})
|
||||
rs = dompurify.sanitize(rs.replace(/▁/g, "▁▁▁"))
|
||||
rs = rs.split('<img ').join(`<img onerror="javascript:this.src='${ imgError }';"`) // 替换replaceall
|
||||
resetMathExpressions()
|
||||
return rs
|
||||
}, [str,issues]);
|
||||
|
||||
|
|
@ -161,4 +166,4 @@ export default ({
|
|||
dangerouslySetInnerHTML={{ __html: html }}
|
||||
></div>
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue