Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit aded3c9

Browse files
committed
cosmetic changes (lint)
1 parent 1b689bb commit aded3c9

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/HtmlUtils.tsx

+5-8
Original file line numberDiff line numberDiff line change
@@ -416,24 +416,21 @@ export function bodyToHtml(content: IContent, highlights: string[], opts: IOpts
416416
if (SdkConfig.get()['latex_maths']) {
417417
const mathDelimiters = [
418418
{ pattern: "<div data-mx-maths=\"([^\"]*)\">(.|\\s)*?</div>", display: true },
419-
{ pattern: "<span data-mx-maths=\"([^\"]*)\">(.|\\s)*?</span>", display: false }
419+
{ pattern: "<span data-mx-maths=\"([^\"]*)\">(.|\\s)*?</span>", display: false },
420420
];
421421

422-
mathDelimiters.forEach(function (d) {
423-
var reg = RegExp(d.pattern, "gm");
424-
425-
safeBody = safeBody.replace(reg, function(match, p1) {
422+
mathDelimiters.forEach(function(d) {
423+
safeBody = safeBody.replace(RegExp(d.pattern, "gm"), function(m, p1) {
426424
return katex.renderToString(
427425
AllHtmlEntities.decode(p1),
428426
{
429427
throwOnError: false,
430428
displayMode: d.display,
431-
output: "mathml"
429+
output: "mathml",
432430
})
433431
});
434432
});
435-
}
436-
433+
}
437434
}
438435
} finally {
439436
delete sanitizeParams.textFilter;

src/editor/serialize.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ export function mdSerialize(model: EditorModel) {
4040
}
4141

4242
export function htmlSerializeIfNeeded(model: EditorModel, {forceHTML = false} = {}) {
43-
var md = mdSerialize(model);
43+
let md = mdSerialize(model);
4444

4545
if (SdkConfig.get()['latex_maths']) {
4646
const displayPattern = (SdkConfig.get()['latex_maths_delims'] || {})['display_pattern'] ||
4747
"\\$\\$\\$(([^$]|\\\\\\$)*)\\$\\$\\$";
4848
const inlinePattern = (SdkConfig.get()['latex_maths_delims'] || {})['inline_pattern'] ||
4949
"\\$\\$(([^$]|\\\\\\$)*)\\$\\$";
5050

51-
md = md.replace(RegExp(displayPattern, "gm"), function(m,p1) {
51+
md = md.replace(RegExp(displayPattern, "gm"), function(m, p1) {
5252
const p1e = AllHtmlEntities.encode(p1);
5353
return `<div data-mx-maths="${p1e}"><code>${p1e}</code></div>`;
5454
});
5555

56-
md = md.replace(RegExp(inlinePattern, "gm"), function(m,p1) {
56+
md = md.replace(RegExp(inlinePattern, "gm"), function(m, p1) {
5757
const p1e = AllHtmlEntities.encode(p1);
5858
return `<span data-mx-maths="${p1e}"><code>${p1e}</code></span>`;
5959
});

0 commit comments

Comments
 (0)