import { CONTENT_EDITOR_HIGHLIGHT_COLOR_NAME_PATTERN } from '@admin/utils/editor/content-editor-highlight-color-name-pattern' const HIGHLIGHT_SPAN_OPEN_PATTERN = new RegExp( `^`, 'i' ) export function matchHtmlMarkSyntax(markdown: string, index: number): number | null { const remaining = markdown.slice(index) const match = /^<\/?(?:u|sub|sup|kbd)>/i.exec(remaining) ?? HIGHLIGHT_SPAN_OPEN_PATTERN.exec(remaining) ?? /^<\/span>/i.exec(remaining) return match ? index + match[0].length : null }