Skip to content

Preprocess imported Markdown snippets#93

Draft
remorses wants to merge 3 commits into
devfrom
imported-mdx-snippets
Draft

Preprocess imported Markdown snippets#93
remorses wants to merge 3 commits into
devfrom
imported-mdx-snippets

Conversation

@remorses
Copy link
Copy Markdown
Owner

@remorses remorses commented May 2, 2026

Summary

  • Preprocesses imported .md and .mdx snippets even when they are not listed in docs.json.
  • Tracks nested Markdown imports transitively so snippets can import other snippets.
  • Replaces raw ?raw snippet loading with a preprocessed markdown registry that safe-mdx resolves recursively.

Validation

  • pnpm --filter @holocron.so/vite build
  • pnpm --filter @holocron.so/vite test
  • pnpm --dir integration-tests test-e2e --project=mdx-imports
  • pnpm --dir integration-tests test-e2e passed 211 tests before the final dead-code cleanup. The targeted mdx-imports suite passed again after cleanup and after switching to the git dependency.

Dependency note

This is draft because it depends on safe-mdx PR #21 for the recursive MDX module API. The branch temporarily points safe-mdx at github:remorses/safe-mdx#recursive-mdx-modules so CI can install the unreleased API. Before this merges, safe-mdx should be released and the dependency should be changed back to a normal semver range.

remorses added 3 commits May 2, 2026 14:24
Process imported `.md` and `.mdx` files even when they are not listed in docs.json, then expose those preprocessed files to safe-mdx as normal MDX modules. This lets page imports, snippet imports, and nested snippet imports share the same preprocessing path for Mintlify transforms, images, and module resolution.

The Vite virtual modules now keep JS/TS imports as lazy loaders and expose imported Markdown through a serializable markdown registry. safe-mdx owns recursive MDX module resolution, so Holocron no longer needs to generate per-snippet wrapper modules or use raw `?raw` imports for Markdown snippets.

Validation:
- pnpm --filter @holocron.so/vite build
- pnpm --filter @holocron.so/vite test
- pnpm --dir integration-tests test-e2e --project=mdx-imports
- pnpm --dir integration-tests test-e2e

Depends on safe-mdx PR #21 for the recursive MDX module API.

Session: ses_2bbe7a7767674a57abc0855d8b43490b
Point Holocron at the safe-mdx branch that exposes the recursive MDX module API so the draft PR can install and validate in CI without relying on a sibling checkout. This is a temporary dependency shape until safe-mdx is released, at which point the dependency should go back to a normal semver range.

Validation:
- pnpm --filter @holocron.so/vite build
- pnpm --filter @holocron.so/vite test
- pnpm --dir integration-tests test-e2e --project=mdx-imports

Session: ses_2bbe7a7767674a57abc0855d8b43490b
Allow the temporary safe-mdx git dependency to run its prepare build in CI. This keeps the draft Holocron integration branch installable while the recursive MDX module API lives on a safe-mdx branch instead of a published semver release.

Validation:
- pnpm install --frozen-lockfile

Session: ses_2bbe7a7767674a57abc0855d8b43490b
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