feat(core): add doc resource reference type for custom documentation pages#2200
feat(core): add doc resource reference type for custom documentation pages#2200
Conversation
…pages Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 37bda63 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37bda63593
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const color = badge?.backgroundColor || badge?.textColor; | ||
| return `${getCustomDocsContentBadgeClasses(color)} ${badge?.class ? badge.class : ''}`; |
There was a problem hiding this comment.
Preserve custom badge text color
This helper now collapses badge styling to a single color derived from backgroundColor, so textColor is effectively ignored for custom doc badges. Any docs that intentionally set contrasting backgroundColor and textColor values will now render with the theme-mapped text color instead of the configured one, which can make badges unreadable or visually incorrect in production docs.
Useful? React with 👍 / 👎.
What This PR Does
Adds a new
[[doc|path/to/doc]]wiki-link syntax for referencing custom documentation pages inline within MDX content. This allows authors to create rich inline links to custom docs pages with tooltips, similar to how events, services, and other resources are referenced. Also extracts badge styling into a shared utility and fixes theming to use CSS variables throughout the custom docs sidebar.Changes Overview
Key Changes
docresource type —ResourceRef.astronow handlestype === 'doc'by looking up entries in thecustomPagescollection and rendering a tooltip with title and summaryresource-ref.tsregex updated to support forward-slash paths in the target (e.g.[[doc|guides/event-storming/02-facilitation]]), replacing the stricter[\w-]+patternnormalizeCustomDocPathhelper — strips URL prefixes and normalizes paths to matchcustomPagescollection IDsbadge-styles.tsextracts repeated badge className logic fromNestedItem.tsxandCustomDocsNav/index.tsxinto a single shared function with CSS variable-based themingindex.astroandVerticalSideBarLayout.astromigrated from hardcoded Tailwind colors /dark:variants to--ec-*CSS variablesresource-ref.spec.tscovering the remark plugin for doc paths,@-versioned paths, and versioned service refs[[doc|...]]syntaxHow It Works
The
[[doc|path/to/doc]]syntax is parsed by the remark plugin which emits aresourceRefMDX component call withtype="doc".ResourceRef.astrodetects this type, fetches the matchingcustomPagesentry by normalizing the path (strippingdocs/custom/prefixes), and renders an inline link with a hover tooltip showing the page title and summary. If the doc is not found, it renders a broken-link styled fallback.Breaking Changes
None
Additional Notes
resource-ref.tsis intentionally permissive for path characters — callers should ensure only valid paths are passeddoctype intentionally bypassesresourceToCollectionMapsince custom pages use a separate lookup pattern🤖 Generated with Claude Code