Skip to content

Commit

Permalink
allow limited markdown in spoiler summary
Browse files Browse the repository at this point in the history
  • Loading branch information
biosfood committed Sep 13, 2023
1 parent f9f8233 commit 8ffd7fb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/shared/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ const spoilerConfig = {

render: (tokens: any, idx: any) => {
var m = tokens[idx].info.trim().match(/^spoiler\s+(.*)$/);
var 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";
Expand Down

0 comments on commit 8ffd7fb

Please sign in to comment.