mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-08 09:34:16 +00:00
allow limited markdown in spoiler summary (#2126)
* allow limited markdown in spoiler summary * use const in markdown spoiler code
This commit is contained in:
parent
f9f8233d6f
commit
d7a80a184f
|
@ -60,11 +60,12 @@ const spoilerConfig = {
|
|||
},
|
||||
|
||||
render: (tokens: any, idx: any) => {
|
||||
var m = tokens[idx].info.trim().match(/^spoiler\s+(.*)$/);
|
||||
const m = tokens[idx].info.trim().match(/^spoiler\s+(.*)$/);
|
||||
const summary = mdToHtmlInline(md.utils.escapeHtml(m[1])).__html;
|
||||
|
||||
if (tokens[idx].nesting === 1) {
|
||||
// opening tag
|
||||
return `<details><summary> ${md.utils.escapeHtml(m[1])} </summary>\n`;
|
||||
return `<details><summary> ${summary} </summary>\n`;
|
||||
} else {
|
||||
// closing tag
|
||||
return "</details>\n";
|
||||
|
@ -110,7 +111,7 @@ function localInstanceLinkParser(md: MarkdownIt) {
|
|||
newTokens.push(textToken);
|
||||
}
|
||||
|
||||
let href;
|
||||
let href: string;
|
||||
if (match[0].startsWith("!")) {
|
||||
href = "/c/" + match[0].substring(1);
|
||||
} else if (match[0].startsWith("/m/")) {
|
||||
|
|
Loading…
Reference in a new issue