Skip to content

fix(docs): resolve ||site.*|| version tokens in imported _includes partials#462

Open
g-despot wants to merge 1 commit into
mainfrom
fix/docs-site-version-token-in-code-tabs
Open

fix(docs): resolve ||site.*|| version tokens in imported _includes partials#462
g-despot wants to merge 1 commit into
mainfrom
fix/docs-site-version-token-in-code-tabs

Conversation

@g-despot

@g-despot g-despot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

||site.java_client_version|| rendered as a literal token (instead of the version) on 5 pages — cloud/quickstart, weaviate/quickstart, cloud/embeddings/quickstart, weaviate/quickstart/local, weaviate/tutorials/quick-tour-of-weaviate. It was the only unresolved ||site.*|| token in the whole build.

Root cause

remark-replace (which interpolates ||site.*||) is registered only in the docs preset's remarkPlugins, which apply to files inside the docs plugin's content dirs. Partials imported from _includes/ are outside those dirs, so Docusaurus compiles them with its MDX fallback loader — which is not passed any remarkPlugins. As a result, remark-replace never ran on partials, and any ||site.*|| token in a partial (here, the Java Maven <version> in the quickstart install tabs) stayed literal. (The same token resolves on the Java client-library docs page only because that's a docs page, not a partial.)

Fix

Route the same interpolation through the global markdown.preprocessor hook, which runs on the raw content of every md/mdx file, including fallback-loaded partials:

  • src/remark/remark-replace.js: extract the interpolation into a shared, exported replaceSiteTokens(value, sourcePath) (single source of truth; the remark plugin now delegates to it — behavior unchanged).
  • docusaurus.config.js: add markdown.preprocessor that calls replaceSiteTokens on each file's content.

Raw-content replacement is a superset of the plugin's node-scoped replacement and is idempotent, so no previously-resolving token can stop resolving.

Verification

yarn build exits 0. All 5 target pages now render the resolved Java version; no ||site.*|| token leaks anywhere in the build; and previously-resolving tokens (weaviate_version, python_client_version, typescript_client_version, the Java docs page) still resolve with no regressions.

…rtials

Version tokens in partials imported from _includes/ (e.g. the Java Maven
version in the quickstart install tabs) rendered as the literal
||site.java_client_version|| on 5 pages. Those partials are compiled by
Docusaurus' MDX *fallback* loader, which does not receive the docs preset's
remarkPlugins, so the remark-replace plugin never ran on them.

Route the same ||site.*|| interpolation through the global markdown.preprocessor
hook, which runs on every md/mdx file (including fallback-loaded partials),
sharing a single implementation (replaceSiteTokens) with the remark plugin.
The replacement is idempotent and its regex is narrow, so pages the plugin
already handles are unaffected.

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant