Resolve typing errors after TypeScript upgrade

This commit is contained in:
J. Ryan Stinnett 2021-01-20 13:40:46 +00:00
parent ea706189a2
commit 84b1f2e6c6
11 changed files with 14 additions and 16 deletions

View file

@ -422,6 +422,8 @@ export function bodyToHtml(content: IContent, highlights: string[], opts: IOpts
if (SettingsStore.getValue("feature_latex_maths")) {
const phtml = cheerio.load(safeBody,
{ _useHtmlParser2: true, decodeEntities: false })
// @ts-ignore - The types for `replaceWith` wrongly expect
// Cheerio instance to be returned.
phtml('div, span[data-mx-maths!=""]').replaceWith(function(i, e) {
return katex.renderToString(
AllHtmlEntities.decode(phtml(e).attr('data-mx-maths')),