Skip to content

Conversation

@sbawabe
Copy link
Contributor

@sbawabe sbawabe commented Dec 5, 2025

Description

Refs: Requested by @sbawabe

When generating docs, <Markdown src="xyz" /> components are replaced with their content, but the reference to the original file is lost. This PR preserves these referenced markdown files by storing them in the jsFiles object of the docs definition.

Changes Made

  • Modified replaceReferencedMarkdown() to track all referenced markdown files and return them alongside the processed markdown
  • Added new types ReferencedMarkdownFile and ReplaceReferencedMarkdownResult to represent the tracked files
  • Updated DocsDefinitionResolver to collect referenced markdown files from all pages and add them to jsFiles
  • Updated previewDocs.ts to handle the new return type
  • Files are stored with their relative path as the key and raw content (before variable substitution) as the value
  • Added deduplication to avoid storing the same file multiple times
  • Updated README.md generator (if applicable)

Testing

  • Unit tests added/updated (all existing tests updated to use new return type)
  • Manual testing completed (lint checks pass, CLI builds successfully)

Human Review Checklist

  • Verify no other callers of replaceReferencedMarkdown exist outside DocsDefinitionResolver Found and updated previewDocs.ts
  • Confirm storing raw content (before variable substitution) is the desired behavior for the use case
  • Consider if the relative path format used as keys in jsFiles matches what the docs-loader expects
  • Verify referencedMarkdownFiles array doesn't accumulate if resolve() is called multiple times on the same DocsDefinitionResolver instance

Link to Devin run: https://app.devin.ai/sessions/200e42b48c144b5b96a758ffdf554cfc
Requested by: Sarah Bawabe ([email protected]) / @sbawabe

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants