From bd7db70bb55f05a0e611d709263294b501c41ab6 Mon Sep 17 00:00:00 2001 From: gerteck Date: Sat, 25 Jul 2026 16:19:29 +0800 Subject: [PATCH 1/2] feat: add CustardUI plugin for interactive component support and documentation --- docs/userGuide/plugins/custardui.md | 65 ++++++++++++++++++++++++++ docs/userGuide/usingPlugins.md | 1 + packages/core/src/plugins/custardui.ts | 30 ++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 docs/userGuide/plugins/custardui.md create mode 100644 packages/core/src/plugins/custardui.ts diff --git a/docs/userGuide/plugins/custardui.md b/docs/userGuide/plugins/custardui.md new file mode 100644 index 0000000000..4f55c7c96e --- /dev/null +++ b/docs/userGuide/plugins/custardui.md @@ -0,0 +1,65 @@ +### Plugin: CustardUI + +
+ +This plugin automatically injects the [CustardUI](https://custardui.js.org/) auto-init script into the page, enhancing generated static sites with more interactivity and personalization. + + + +CustardUI provides additional custom elements like ``, ``, placeholders, page highlighting capabilities, and more. + + + +To enable this plugin, add `custardui` to your site's plugins. + +```js {heading="site.json"} +{ + ... + "plugins": [ + "custardui" + ] +} +``` + + + +By default, the plugin sets the `data-base-url` attribute for CustardUI to `/`. If you are hosting your site in a subdirectory or need to customize this base URL, you can configure it under `pluginsContext`. + +```js {heading="site.json"} +{ + ... + "pluginsContext": { + "custardui": { + "baseUrl": "/my-base-url" + } + } +} +``` + + + +
+ +**Adding a CustardUI configuration file**: + +After enabling the plugin, create a `custardui.config.json` file in your site's root directory. This tells CustardUI what options and features to expose to your readers. + +Here is a sample configuration with the settings panel enabled: + +```json {heading="custardui.config.json"} +{ + "config": { + "toggles": [ + { "toggleId": "mac", "label": "macOS", "description": "Show macOS instructions" }, + { "toggleId": "win", "label": "Windows", "description": "Show Windows instructions" } + ] + }, + "settings": { + "enabled": true + } +} +``` + +With this configuration, readers will see a settings panel they can use to switch between viewing macOS and Windows content. For more information, check out the [CustardUI documentation](https://custardui.js.org/). + +
diff --git a/docs/userGuide/usingPlugins.md b/docs/userGuide/usingPlugins.md index 9f7cc9fdd9..3232d123cc 100644 --- a/docs/userGuide/usingPlugins.md +++ b/docs/userGuide/usingPlugins.md @@ -66,6 +66,7 @@ MarkBind has a set of built-in plugins that can be used immediately without inst + ## Using External Plugins diff --git a/packages/core/src/plugins/custardui.ts b/packages/core/src/plugins/custardui.ts new file mode 100644 index 0000000000..599379ca86 --- /dev/null +++ b/packages/core/src/plugins/custardui.ts @@ -0,0 +1,30 @@ +import { PluginContext } from './Plugin.js'; + +/** + * CustardUI Plugin for MarkBind + * Injects the CustardUI auto-init script into every page. + */ + +const getScripts = (pluginContext: PluginContext) => { + const baseUrl = pluginContext?.baseUrl || '/'; + return [ + // Latest Stable Release + '`, + ]; +}; + +const tagConfig = { + 'cv-toggle': { isCustomElement: true }, + 'cv-toggle-control': { isCustomElement: true }, + 'cv-tabgroup': { isCustomElement: true }, + 'cv-tab': { isCustomElement: true }, + 'cv-tab-body': { isCustomElement: true }, + 'cv-tab-header': { isCustomElement: true }, + 'cv-define-placeholder': { isCustomElement: true }, + 'cv-placeholder-input': { isCustomElement: true }, + 'cv-label': { isCustomElement: true }, + 'cv-insertion': { isCustomElement: true }, +}; + +export { getScripts, tagConfig }; From f0218e772243daeee24e50454371fd2d7724e027 Mon Sep 17 00:00:00 2001 From: gerteck Date: Wed, 29 Jul 2026 01:12:31 +0800 Subject: [PATCH 2/2] Add tip for site.json ignore --- docs/userGuide/plugins/custardui.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/userGuide/plugins/custardui.md b/docs/userGuide/plugins/custardui.md index 4f55c7c96e..542edf8bb2 100644 --- a/docs/userGuide/plugins/custardui.md +++ b/docs/userGuide/plugins/custardui.md @@ -44,6 +44,12 @@ By default, the plugin sets the `data-base-url` attribute for CustardUI to `/`. After enabling the plugin, create a `custardui.config.json` file in your site's root directory. This tells CustardUI what options and features to expose to your readers. + + +Make sure your `site.json` ignore list does not exclude JSON files, or MarkBind will not copy `custardui.config.json` into the generated site and the plugin will not work. + + + Here is a sample configuration with the settings panel enabled: ```json {heading="custardui.config.json"}