From d437f175a88daed3388ac136b214e860aca99db3 Mon Sep 17 00:00:00 2001 From: qiansheng91 Date: Mon, 15 Jun 2026 14:51:43 +0800 Subject: [PATCH] fix(docs): restore theme interpolation + transparent logo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docs landing page shipped raw `{{ site.title }}` / `{{ text }}` / `{{ translate('button.buttonText') }}` in the built HTML — the default theme's interpolation was not rendering. Cause: shared.ts globally overrode Vue's template delimiters to stop the docs' literal `${{src.service_id}}` examples from interpolating, which also disabled the theme's own `{{ }}`. (Dev uses prebuilt theme assets, so it surfaced only in the build/deploy.) Replace the global override with a targeted markdown rule that entity-escapes braces in inline code only: theme renders, the `${{ }}` examples stay literal, source docs + GitHub rendering unchanged. This also fixes clicking the site title not returning home (the link was always /UnifiedModel/). - docs/.vitepress/config/shared.ts: drop vue.compilerOptions.delimiters; add a markdown code_inline brace-escape rule. - docs/public/openumodel-mark.svg: chroma-key the baked white background to transparent (the blue U is unchanged). - docs/.npmrc: replace shamefully-hoist with a targeted public-hoist-pattern for mermaid's deps (no over-hoisting). --- docs/.npmrc | 15 ++++++++++----- docs/.vitepress/config/shared.ts | 24 +++++++++++++++--------- docs/public/openumodel-mark.svg | 2 +- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/docs/.npmrc b/docs/.npmrc index b999ab9..b222479 100644 --- a/docs/.npmrc +++ b/docs/.npmrc @@ -1,6 +1,11 @@ # VitePress + vitepress-plugin-mermaid force mermaid's transitive deps -# (cytoscape, dayjs, @braintree/sanitize-url, ...) into Vite's optimizeDeps. -# pnpm's default isolated node_modules does not hoist them to the top level, -# so the dev server fails to pre-bundle and renders a blank page. Flatten the -# docs package's node_modules so Vite can resolve them. Dev-tooling only. -shamefully-hoist=true +# (cytoscape, dayjs, @braintree/sanitize-url, …) into Vite's optimizeDeps, but +# pnpm's isolated node_modules does not expose them at the top level, so the dev +# server fails to pre-bundle them and renders a blank page. +# +# Hoist ONLY those specific deps. Do NOT use `shamefully-hoist=true`: hoisting +# everything shadows VitePress's @vue/* packages with mismatched copies, which +# breaks SSR template compilation and ships raw `{{ }}` in the built HTML. +public-hoist-pattern[]=*cytoscape* +public-hoist-pattern[]=dayjs +public-hoist-pattern[]=@braintree/sanitize-url diff --git a/docs/.vitepress/config/shared.ts b/docs/.vitepress/config/shared.ts index b609dfd..699859c 100644 --- a/docs/.vitepress/config/shared.ts +++ b/docs/.vitepress/config/shared.ts @@ -29,15 +29,21 @@ export const shared: UserConfig = { 'zh/README.md': 'zh/index.md', }, - // The reused docs contain literal mustache examples in inline code - // (e.g. `${{src.service_id}}` in fields_mapping). Move Vue's delimiters to - // unused tokens so `{{ }}` renders literally — no source edits, GitHub - // rendering preserved. - vue: { - template: { - compilerOptions: { - delimiters: ['__vp_no_interp_open__', '__vp_no_interp_close__'], - }, + // The reused docs use literal `{{ }}` inside inline code (e.g. + // `${{src.service_id}}`). Vue would treat those as interpolation and break the + // build. Entity-escape braces in inline code only, so they render literally — + // without changing Vue's global delimiters (which breaks the theme's own + // `{{ }}`) and without editing the source docs. GitHub rendering is unaffected. + markdown: { + config: (md) => { + md.renderer.rules.code_inline = (tokens, idx, _options, _env, self) => { + const token = tokens[idx] + const content = md.utils + .escapeHtml(token.content) + .replace(/{/g, '{') + .replace(/}/g, '}') + return `${content}` + } }, }, diff --git a/docs/public/openumodel-mark.svg b/docs/public/openumodel-mark.svg index d569095..d4c2c1d 100644 --- a/docs/public/openumodel-mark.svg +++ b/docs/public/openumodel-mark.svg @@ -1,3 +1,3 @@ - +