Support inline markdown in spoiler summary

Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
Yukai Huang 2020-03-09 10:15:01 +08:00
parent 42ae89cc72
commit 8f4ccb967d
No known key found for this signature in database
GPG Key ID: A76CBD50B22052C0
2 changed files with 2 additions and 2 deletions

View File

@ -1124,7 +1124,7 @@ md.use(markdownitContainer, 'spoiler', {
// opening tag // opening tag
const summary = m[1] && m[1].trim() const summary = m[1] && m[1].trim()
if (summary) { if (summary) {
return `<details><summary>${md.utils.escapeHtml(summary)}</summary>\n` return `<details><summary>${md.renderInline(summary)}</summary>\n`
} else { } else {
return `<details>\n` return `<details>\n`
} }

View File

@ -125,7 +125,7 @@ md.use(markdownitContainer, 'spoiler', {
const partClass = `class="part raw" data-startline="${startline}" data-endline="${endline}"` const partClass = `class="part raw" data-startline="${startline}" data-endline="${endline}"`
const summary = m[1] && m[1].trim() const summary = m[1] && m[1].trim()
if (summary) { if (summary) {
return `<details ${partClass}><summary>${md.utils.escapeHtml(summary)}</summary>\n` return `<details ${partClass}><summary>${md.renderInline(summary)}</summary>\n`
} else { } else {
return `<details ${partClass}>\n` return `<details ${partClass}>\n`
} }