From 20d06c0de82f54c0b3ffc3161db31c4717a68128 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 5 Apr 2024 00:12:15 +0800 Subject: [PATCH] perf(plugin-md-power): codeSandbox button --- plugins/plugin-md-power/src/node/features/codeSandbox.ts | 4 ++-- plugins/plugin-md-power/src/shared/codeSandbox.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/plugin-md-power/src/node/features/codeSandbox.ts b/plugins/plugin-md-power/src/node/features/codeSandbox.ts index f52f1165..279327ec 100644 --- a/plugins/plugin-md-power/src/node/features/codeSandbox.ts +++ b/plugins/plugin-md-power/src/node/features/codeSandbox.ts @@ -1,7 +1,7 @@ /** * @[codesandbox](id) * @[codesandbox share](user/id) - * @[codesanbox title="xxx" layout="Editor+Preview" height="500px" navbar=false console=false](id#filepath) + * @[codesanbox title="xxx" layout="Editor+Preview" height="500px" navbar="false" console="false"](id#filepath) */ import type { PluginWithOptions } from 'markdown-it' import type { RuleBlock } from 'markdown-it/lib/parser_block.js' @@ -16,7 +16,7 @@ const MIN_LENGTH = 16 const START_CODES = [64, 91, 99, 111, 100, 101, 115, 97, 110, 100, 98, 111, 120] // regexp to match the import syntax -const SYNTAX_RE = /^@\[codesandbox(?:\s+(embed|share))?(?:\s+([^]*?))?\]\(([^)]*?)\)/ +const SYNTAX_RE = /^@\[codesandbox(?:\s+(embed|button))?(?:\s+([^]*?))?\]\(([^)]*?)\)/ function createCodeSandboxRuleBlock(): RuleBlock { return (state, startLine, endLine, silent) => { diff --git a/plugins/plugin-md-power/src/shared/codeSandbox.ts b/plugins/plugin-md-power/src/shared/codeSandbox.ts index 759af21f..f9acae93 100644 --- a/plugins/plugin-md-power/src/shared/codeSandbox.ts +++ b/plugins/plugin-md-power/src/shared/codeSandbox.ts @@ -4,7 +4,7 @@ export interface CodeSandboxTokenMeta extends SizeOptions { user?: string id?: string layout?: string - type?: 'share' | 'embed' + type?: 'button' | 'embed' title?: string filepath?: string navbar?: boolean