Skip to content

Commit

Permalink
perf(plugin-md-power): codeSandbox button
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed Apr 4, 2024
1 parent 053cabf commit 20d06c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/plugin-md-power/src/node/features/codeSandbox.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugin-md-power/src/shared/codeSandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 20d06c0

Please sign in to comment.