This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 2a3522117 Add comprehensive debugging and single-brace placeholder
handling
2a3522117 is described below
commit 2a3522117591f8a9ee8aeb3d64c74e47c647ac43
Author: James Bognar <[email protected]>
AuthorDate: Tue Sep 23 09:54:57 2025 -0400
Add comprehensive debugging and single-brace placeholder handling
- Add post-replacement debugging to detect problematic placeholder formats
- Handle single-brace variants {API_DOCS} and {JUNEAU_VERSION} that might
cause MDX issues
- Add detection for bare API_DOCS references that MDX could interpret as
JavaScript
- Enhanced logging to trace exactly what content MDX sees after replacement
---
.../src/plugins/remark-version-replacer.js | 24 +++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/juneau-docs-poc/src/plugins/remark-version-replacer.js
b/juneau-docs-poc/src/plugins/remark-version-replacer.js
index 6b010923c..7b061622d 100644
--- a/juneau-docs-poc/src/plugins/remark-version-replacer.js
+++ b/juneau-docs-poc/src/plugins/remark-version-replacer.js
@@ -19,7 +19,10 @@
function replaceInString(content, version, apiDocsUrl) {
return content
.replace(/\{\{JUNEAU_VERSION\}\}/g, version)
- .replace(/\{\{API_DOCS\}\}/g, apiDocsUrl);
+ .replace(/\{\{API_DOCS\}\}/g, apiDocsUrl)
+ // Also handle any potential single-brace variants that might cause MDX
issues
+ .replace(/\{JUNEAU_VERSION\}/g, version)
+ .replace(/\{API_DOCS\}/g, apiDocsUrl);
}
/**
@@ -70,11 +73,30 @@ function remarkVersionReplacer(options = {}) {
if (file.data) file.data = replacedContent;
const stillHasPlaceholders = replacedContent.includes('{{API_DOCS}}') ||
replacedContent.includes('{{JUNEAU_VERSION}}');
+
+ // Check for problematic single-brace or bare references that MDX might
interpret as JS
+ const hasSingleBraceApiDocs = replacedContent.includes('{API_DOCS}');
+ const hasBareApiDocs = replacedContent.match(/[^{]API_DOCS[^}]/);
+
+ if (fileName.includes('10.01.00.JuneauRestClientBasics')) {
+ console.log(`🔍 POST-REPLACEMENT DEBUG - ${fileName}:`);
+ console.log(`📋 Still has {{API_DOCS}}:
${replacedContent.includes('{{API_DOCS}}')}`);
+ console.log(`📋 Has single {API_DOCS}: ${hasSingleBraceApiDocs}`);
+ console.log(`📋 Has bare API_DOCS: ${!!hasBareApiDocs}`);
+ if (hasBareApiDocs) {
+ console.log(`📋 Bare API_DOCS context: ${hasBareApiDocs[0]}`);
+ }
+ }
+
if (stillHasPlaceholders) {
console.log(`⚠️ WARNING: Still has unreplaced placeholders in
${file.path || 'unknown'}`);
} else if (hasApiDocs || hasVersion) {
console.log(`✅ Successfully replaced placeholders in ${file.path ||
'unknown'}`);
}
+
+ if (hasSingleBraceApiDocs || hasBareApiDocs) {
+ console.log(`🚨 POTENTIAL MDX ISSUE: Found problematic API_DOCS
reference in ${file.path || 'unknown'}`);
+ }
}
// No need for AST traversal since string replacement handles all cases
};