From 0947726f2de7fd4e6088ee73b77af819d4488bbd Mon Sep 17 00:00:00 2001 From: forest <43224707+forestxieCode@users.noreply.github.com> Date: Fri, 10 Feb 2023 21:03:08 +0800 Subject: [PATCH] fix(extension): fixed regex mismatch under CRLF (#850) --- packages/varlet-cli/src/node/shared/constant.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/varlet-cli/src/node/shared/constant.ts b/packages/varlet-cli/src/node/shared/constant.ts index ed882e426ba..66c994069c8 100644 --- a/packages/varlet-cli/src/node/shared/constant.ts +++ b/packages/varlet-cli/src/node/shared/constant.ts @@ -40,17 +40,17 @@ export const SITE_CONFIG = resolve(CWD, '.varlet/site.config.json') // template highlight export const HL_DIR = resolve(CWD, 'highlight') export const HL_COMPONENT_NAME_RE = /.*(\/|\\)(.+)(\/|\\)docs(\/|\\)/ -export const HL_API_RE = /##\s*API\n+/ +export const HL_API_RE = /##\s*API(?:\r\n|\n)+/ -export const HL_EN_TITLE_ATTRIBUTES_RE = /###\s*Props\s*\n+/ -export const HL_EN_TITLE_EVENTS_RE = /###\s*Events\s*\n+/ -export const HL_EN_TITLE_SLOTS_RE = /###\s*Slots\s*\n+/ +export const HL_EN_TITLE_ATTRIBUTES_RE = /###\s*Props(?:\r\n|\n)+/ +export const HL_EN_TITLE_EVENTS_RE = /###\s*Events(?:\r\n|\n)+/ +export const HL_EN_TITLE_SLOTS_RE = /###\s*Slots(?:\r\n|\n)+/ export const HL_EN_MD = 'en-US.md' export const HL_EN_WEB_TYPES_JSON = resolve(HL_DIR, 'web-types.en-US.json') -export const HL_ZH_TITLE_ATTRIBUTES_RE = /###\s*属性\s*\n+/ -export const HL_ZH_TITLE_EVENTS_RE = /###\s*事件\s*\n+/ -export const HL_ZH_TITLE_SLOTS_RE = /###\s*插槽\s*\n+/ +export const HL_ZH_TITLE_ATTRIBUTES_RE = /###\s*属性(?:\r\n|\n)+/ +export const HL_ZH_TITLE_EVENTS_RE = /###\s*事件(?:\r\n|\n)+/ +export const HL_ZH_TITLE_SLOTS_RE = /###\s*插槽(?:\r\n|\n)+/ export const HL_ZH_MD = 'zh-CN.md' export const HL_ZH_WEB_TYPES_JSON = resolve(HL_DIR, 'web-types.zh-CN.json')