1
0
mirror of https://github.com/one-among-us/data.git synced 2024-11-22 19:24:51 +08:00

[+] handle strikethrough

This commit is contained in:
Elihuso 2024-05-06 08:27:44 +08:00
parent b87584b147
commit 1381aca260

View File

@ -153,6 +153,9 @@ function buildPeoplePages() {
// Handle Footnote // Handle Footnote
markdown = handleFootnote(markdown) markdown = handleFootnote(markdown)
// Handle Delete Line: ~~something~~ to <del>something</del>
markdown = handleDeleteLine(markdown)
// Handle Icon // Handle Icon
markdown = handleNoteIcon(markdown) markdown = handleNoteIcon(markdown)
@ -184,6 +187,12 @@ function handleFootnote(md: string) {
.replace(/(<li id="footnote.*<\/li>)/gs, '<ol>\n$1\n</ol>') .replace(/(<li id="footnote.*<\/li>)/gs, '<ol>\n$1\n</ol>')
} }
function handleDeleteLine(md: string): string {
if (!md.includes('~~')) return md;
return md.replace(/~~(.*?)~~/g, (match, text) => ("<del>" + text + "</del>"));
}
function handleNoteIcon(md: string): string { function handleNoteIcon(md: string): string {
if (!md.includes('[!')) return md; if (!md.includes('[!')) return md;
return md.replace(/\[\!(\w+)\](?::\s*(.*))?/g, (match, icon, _) => (Icon[icon as string])); return md.replace(/\[\!(\w+)\](?::\s*(.*))?/g, (match, icon, _) => (Icon[icon as string]));