client/js/markdown: fix processing of inline markdown

This commit is contained in:
Shyam Sunder 2022-02-16 09:09:21 -05:00
parent b2582b7b0f
commit 514b846781
2 changed files with 3 additions and 4 deletions

View file

@ -10,4 +10,3 @@ ignorePatterns:
- build.js - build.js
parserOptions: parserOptions:
ecmaVersion: 11 ecmaVersion: 11
sourceType: module

View file

@ -1,6 +1,6 @@
"use strict"; "use strict";
import { marked } from "marked"; const marked = require("marked");
const DOMPurify = require("dompurify"); const DOMPurify = require("dompurify");
class BaseMarkdownWrapper { class BaseMarkdownWrapper {
@ -159,7 +159,7 @@ function formatMarkdown(text) {
for (let wrapper of wrappers) { for (let wrapper of wrappers) {
text = wrapper.preprocess(text); text = wrapper.preprocess(text);
} }
text = marked(text, options); text = marked.parse(text, options);
wrappers.reverse(); wrappers.reverse();
for (let wrapper of wrappers) { for (let wrapper of wrappers) {
text = wrapper.postprocess(text); text = wrapper.postprocess(text);
@ -185,7 +185,7 @@ function formatInlineMarkdown(text) {
for (let wrapper of wrappers) { for (let wrapper of wrappers) {
text = wrapper.preprocess(text); text = wrapper.preprocess(text);
} }
text = marked.inlineLexer(text, [], options); text = marked.parseInline(text, options);
wrappers.reverse(); wrappers.reverse();
for (let wrapper of wrappers) { for (let wrapper of wrappers) {
text = wrapper.postprocess(text); text = wrapper.postprocess(text);