diff --git a/src/components/CommentItem.vue b/src/components/CommentItem.vue
index dd2fbdf..5eedf72 100644
--- a/src/components/CommentItem.vue
+++ b/src/components/CommentItem.vue
@@ -196,26 +196,28 @@ domPurifyInstance.addHook('uponSanitizeElement', (node) => {
node.outerHTML = `
${quoteHTML}
`;
} else if (new RegExp('^(-|\\*) ?.').test(node.innerHTML)) {
- // unordered list (starts with '-' or '*')
+ // unordered list (starts with dash or asterisk)
let listItemHTML = node.innerHTML;
while (new RegExp('^(-|\\*| )').test(listItemHTML)) {
listItemHTML = listItemHTML.substring(1);
}
+ listItemHTML = listItemHTML.replace(/\n(-|\*) ?/g, '- ');
+
node.outerHTML = ``;
- } else if (new RegExp('^\\d\\. .').test(node.innerHTML)) {
- // ordered list (starts with single digit + '.')
- const digit = node.innerHTML.match(/^\d/);
- if (!digit) return;
+ } else if (new RegExp('^(\\d|[A-Z])(\\.|\\)) .').test(node.innerHTML)) {
+ // ordered list (starts with digit or uppercase letter followed by period or parenthesis)
+ const counter = node.innerHTML.match(/^(\d|[A-Z])/);
+ if (!counter) return;
let listItemHTML = node.innerHTML;
- while (new RegExp('^(\\d|\\.| )').test(listItemHTML)) {
+ while (new RegExp('^(\\d|[A-Z](\\.|\\))|\\.|\\)| )').test(listItemHTML)) {
listItemHTML = listItemHTML.substring(1);
}
- node.outerHTML = `
- ${listItemHTML}
`;
+ node.outerHTML = `- ${listItemHTML}
`;
}
});