@@ -387,6 +387,53 @@ Different repositories may have different link structures or conventions. The `r
387387- Adjusting image paths
388388- Handling repository-specific markdown formats
389389
390+ #### Link Transformation Behavior
391+
392+ The system automatically transforms relative links in markdown files to ensure they work correctly in the documentation site:
393+
394+ ** Relative Links → GitHub URLs**
395+ - Links without ` ./ ` prefix (e.g., ` [file.md](file.md) ` or ` [PR_SIGNOFF.md](PR_SIGNOFF.md) ` )
396+ - Links with ` ./ ` prefix (e.g., ` [file.md](./file.md) ` )
397+ - Links with ` ../ ` navigation (e.g., ` [file.md](../../other/file.md) ` )
398+ - All are transformed to absolute GitHub URLs: ` https://github.com/org/repo/blob/main/path/file.md `
399+
400+ ** Internal Guide Links → Local Docs**
401+ - Specific guide files listed in ` INTERNAL_GUIDE_MAPPINGS ` (in ` repo-transforms.js ` )
402+ - These stay within the docs site for better navigation
403+ - Example: ` guides/QUICKSTART.md ` → ` /docs/guide/Installation/quickstart `
404+
405+ ** Images → GitHub Raw URLs**
406+ - All relative image paths are converted to GitHub raw URLs
407+ - Example: `  ` → `  `
408+
409+ ** Using ` createStandardTransform() ` **
410+
411+ All content sources should use ` createStandardTransform() ` to get consistent link handling:
412+
413+ ``` javascript
414+ const contentTransform = createStandardTransform (' llm-d' );
415+
416+ // Then pass it to createContentWithSource:
417+ createContentWithSource ({
418+ // ... other options
419+ contentTransform // Apply standard transformations
420+ })
421+ ```
422+
423+ For special cases where you need to override specific links after transformation:
424+
425+ ``` javascript
426+ const contentTransform = (content , sourcePath ) => {
427+ const standardTransform = createStandardTransform (' llm-d' );
428+ const transformed = standardTransform (content, sourcePath);
429+
430+ // Override specific GitHub links to stay local
431+ return transformed
432+ .replace (/ \( https:\/\/ github\. com\/ llm-d\/ llm-d\/ blob\/ main\/ CODE_OF_CONDUCT\. md\) / g , ' (code-of-conduct)' )
433+ .replace (/ \( https:\/\/ github\. com\/ llm-d\/ llm-d\/ blob\/ main\/ SIGS\. md\) / g , ' (sigs)' );
434+ };
435+ ```
436+
390437## 📁 File Structure
391438
392439```
@@ -468,14 +515,16 @@ For non-component content:
468515| Page not appearing | Check source URL is publicly accessible |
469516| Build errors | Verify all ` YOUR-... ` placeholders are replaced |
470517| Wrong sidebar order | Check ` sidebarPosition ` numbers |
471- | Links broken | Use ` contentTransform ` to fix relative links or add to ` repo-transforms.js ` |
518+ | Links broken | Ensure you're using ` createStandardTransform() ` - it automatically fixes relative links to GitHub URLs |
519+ | Relative links not working | All relative links (with or without ` ./ ` ) are automatically converted to GitHub URLs by ` createStandardTransform() ` |
472520| Import errors | Ensure file is imported in ` remote-content/remote-content.js ` with correct path |
473521| Component not showing | Check ` component-configs.js ` and ensure repository is public |
474522| Source banner missing | Verify you're using ` createContentWithSource() ` from utils.js |
475523| Banner at wrong location | Source banners now appear at bottom of pages automatically |
476524| Import path errors | Use ` ../ ` to reference utils from subdirectories (e.g., ` ../utils.js ` ) |
477525| File in wrong directory | Move to appropriate subdirectory: ` architecture/ ` , ` guide/ ` , or ` community/ ` |
478526| Template not working | Ensure you're using the updated template with correct import paths |
527+ | Need local links | Override specific links after ` createStandardTransform() ` - see "Using ` createStandardTransform() ` " section above |
479528
480529## 📝 Content Source Banners
481530
0 commit comments