Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/devGuide/development/writingPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ Tag properties are top-level properties of the tag configuration object. The fol

Property | Values | Default | Remarks
:----- | ------- | ---- | ----
`isSpecial` | `true` or `false` | `false` | Allows configuring whether any tag is to be parsed "specially" like a `<script>` or `<style>` tag. This allows configuring custom tags that may contain conflicting syntax, such as the `<puml>` tag used for UML diagram generation.
`isSpecial` | `true` or `false` | `false` | When `true`, the content inside the tag is treated as raw text and will **not** be parsed as HTML or Markdown (similar to `<script>` or `<style>` tags). Use this for tags containing non-HTML syntax that should not be processed (e.g. `<puml>` for diagrams). Use `false` for standard components that wrap renderable content.
`customComponent` | `true` or `false` | `false` | Tells the Vue compiler to ignore this tag during compilation. Useful for plugins that introduce custom HTML elements (e.g. Web Components) that should not be resolved as Vue components.
`attributes` | Array of attribute configurations | `[]` | Contains the attribute configurations of the tags.

**Attribute Properties**
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/Page/PageVueServerRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import fs from 'fs-extra';
import * as logger from '../utils/logger';
import type { PageConfig, PageAssets } from './PageConfig';
import type { Page } from '.';
import { PluginManager } from '../plugins/PluginManager';

/* eslint-enable import/no-import-module-exports */

let bundle = require('@markbind/core-web/dist/js/vueCommonAppFactory.min');
Expand All @@ -32,11 +34,16 @@ let bundle = require('@markbind/core-web/dist/js/vueCommonAppFactory.min');
*/
async function compileVuePageCreateAndReturnScript(
content: string, pageConfig: PageConfig, pageAsset: PageAssets) {
const customElementTags = new Set(Object.entries(PluginManager.tagConfig)
.filter(([, config]) => config.customComponent)
.map(([tagName]) => tagName));
Comment on lines +37 to +39
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new feature lacks test coverage. Consider adding tests to verify that tags with customComponent: true are correctly passed to the Vue compiler's isCustomElement option. This would help ensure the feature works as expected and prevent regressions in the future.

Copilot uses AI. Check for mistakes.

const compilerOptions: CompilerOptions = {
runtimeModuleName: 'vue',
runtimeGlobalName: 'Vue',
mode: 'function',
whitespace: 'preserve',
isCustomElement: tag => customElementTags.has(tag),
};

const templateOptions: SFCTemplateCompileOptions = {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/plugins/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ type TagConfigAttributes = {

export type TagConfigs = {
isSpecial: boolean,
attributes: TagConfigAttributes[]
attributes: TagConfigAttributes[],
customComponent?: boolean,
};

/**
Expand Down
Loading