mirror of
https://github.com/one-among-us/data.git
synced 2024-11-26 04:57:38 +08:00
[+] handle strikethrough
This commit is contained in:
parent
b87584b147
commit
1381aca260
@ -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]));
|
||||||
|
Loading…
Reference in New Issue
Block a user