From bd71a6395f0774974889bc5928f0e3824bd849de Mon Sep 17 00:00:00 2001 From: Timeless0911 <1604889533@qq.com> Date: Thu, 18 Apr 2024 17:14:58 +0800 Subject: [PATCH] feat(playgroud): pass source path to custom render --- packages/plugin-playground/src/cli/remarkPlugin.ts | 1 + .../plugin-playground/static/global-components/Playground.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/plugin-playground/src/cli/remarkPlugin.ts b/packages/plugin-playground/src/cli/remarkPlugin.ts index f2466f7f9..391feb487 100644 --- a/packages/plugin-playground/src/cli/remarkPlugin.ts +++ b/packages/plugin-playground/src/cli/remarkPlugin.ts @@ -65,6 +65,7 @@ export const remarkPlugin: Plugin<[RemarkPluginProps], Root> = ({ createPlaygroundNode(node, [ ['code', code], ['language', language], + ['source', demoPath], ['direction', direction], ['editorPosition', editorPosition], ]); diff --git a/packages/plugin-playground/static/global-components/Playground.tsx b/packages/plugin-playground/static/global-components/Playground.tsx index 7e0aea799..11066f1c2 100644 --- a/packages/plugin-playground/static/global-components/Playground.tsx +++ b/packages/plugin-playground/static/global-components/Playground.tsx @@ -13,6 +13,7 @@ type Direction = 'horizontal' | 'vertical'; export interface PlaygroundProps extends HTMLAttributes { code: string; language: string; + source?: string; direction?: Direction; editorPosition?: 'left' | 'right'; renderChildren?: (