fix(docs): resolve ||site.*|| version tokens in imported _includes partials#462
Open
g-despot wants to merge 1 commit into
Open
fix(docs): resolve ||site.*|| version tokens in imported _includes partials#462g-despot wants to merge 1 commit into
g-despot wants to merge 1 commit into
Conversation
…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.
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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'sremarkPlugins, 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 anyremarkPlugins. As a result,remark-replacenever 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.preprocessorhook, 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, exportedreplaceSiteTokens(value, sourcePath)(single source of truth; the remark plugin now delegates to it — behavior unchanged).docusaurus.config.js: addmarkdown.preprocessorthat callsreplaceSiteTokenson 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 buildexits 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.