공개 본문 목록 편집 분리

This commit is contained in:
2026-07-27 16:29:23 +09:00
parent 16ea10229e
commit 9efa6d6af5
11 changed files with 407 additions and 151 deletions

View File

@@ -12,13 +12,13 @@ export const stripQuoteMarker = (value) => String(value ?? '').replace(/^(?:>\s*
* @returns {string} 본문
*/
export const stripListMarker = (value, ordered = false) => {
const raw = String(value ?? '').trim()
const raw = String(value ?? '')
if (ordered) {
return raw.replace(/^\d+\.\s*/, '').trim()
return raw.replace(/^\s*\d+\.\s*/, '').trim()
}
return raw.replace(/^[-*+]\s+/, '').trim()
return raw.replace(/^\s*[-*+]\s*/, '').trim()
}
/**
@@ -35,13 +35,13 @@ export const hasQuoteMarker = (value) => /^\s*>/.test(String(value ?? ''))
* @returns {boolean}
*/
export const hasListMarker = (value, ordered = false) => {
const raw = String(value ?? '').trim()
const raw = String(value ?? '')
if (ordered) {
return /^\d+\.\s*/.test(raw)
return /^\s*\d+\.(?:\s|$)/.test(raw)
}
return /^[-*+]\s/.test(raw)
return /^\s*[-*+](?:\s|$)/.test(raw)
}
/**