From 814364489f17926253a000ace43820ab9008770f Mon Sep 17 00:00:00 2001 From: L-Sun Date: Wed, 11 Jun 2025 14:40:51 +0800 Subject: [PATCH] chore(editor): remove unused codes (#12784) Continue #12778 ## Summary by CodeRabbit - **Chores** - Removed internal string utility functions related to markdown prefix and horizontal rule detection. No impact on user-facing features. --- blocksuite/affine/shared/src/utils/string.ts | 32 -------------------- 1 file changed, 32 deletions(-) diff --git a/blocksuite/affine/shared/src/utils/string.ts b/blocksuite/affine/shared/src/utils/string.ts index 3136e467f2..753a816105 100644 --- a/blocksuite/affine/shared/src/utils/string.ts +++ b/blocksuite/affine/shared/src/utils/string.ts @@ -73,35 +73,3 @@ export function substringMatchScore(name: string, query: string) { // normalize return 0.5 * score; } - -/** - * Checks if the prefix is a markdown prefix. - * Ex. 1. 2. 3. - * [] [ ] [x] # ## ### #### ##### ###### --- *** ___ > ``` - */ -export function isMarkdownPrefix(prefix: string) { - return ( - !!prefix.match( - /^(\d+\.|-|\*|\[ ?\]|\[x\]|(#){1,6}|>|```([a-zA-Z0-9]*))$/ - ) || isHorizontalRuleMarkdown(prefix) - ); -} - -/** - * Checks if the prefix is a valid markdown horizontal rule - https://www.markdownguide.org/basic-syntax/#horizontal-rules - * @param prefix - The string to check for horizontal rule syntax - * @returns boolean - True if the string represents a valid horizontal rule - * - * Valid horizontal rules: - * - Three or more consecutive hyphens (e.g., "---", "----") - * - Three or more consecutive asterisks (e.g., "***", "****") - * - Three or more consecutive underscores (e.g., "___", "____") - * - * Invalid examples: - * - Mixed characters (e.g., "--*", "-*-") - * - Less than three characters (e.g., "--", "**") - */ -export function isHorizontalRuleMarkdown(prefix: string) { - const horizontalRulePattern = /^(-{3,}|\*{3,}|_{3,})$/; - - return !!prefix.match(horizontalRulePattern); -}