docs: re-adopt global theme; components self-inject CSS#716
Conversation
Signed-off-by: Johnny Greco <jogreco@nvidia.com>
Re-adopts the canonical NVIDIA Fern global theme (global-theme: nvidia) and fixes the root cause that forced the #715 hotfix revert: `css` is a theme-owned field, so under a global theme Fern replaces the child repo's `css:` list with the theme's stylesheets at publish, silently dropping DataDesigner's product CSS. Instead of relying on the (theme-owned) `css:` field, each dev-note kit component now injects its own styles via a <style dangerouslySetInnerHTML> tag in its render output. Component MDX is not theme-owned, so the styling survives the theme merge. This is the same approach NemoClaw uses. - docs.yml: add global-theme: nvidia; drop theme-owned footer/layout/ colors/theme/favicon/js and the entire css: block; keep the partial logo override, GitHub navbar link, and MDX components. - Inline each component's CSS as a <style> tag: BlogCard/BlogGrid, Authors, NotebookViewer, MetricsTable, TrajectoryViewer, and the badge-icon rule in BadgeLinks. - Remove now-unused fern/main.css, fern/styles/*.css, the local NVIDIA logo SVGs, and CustomFooter.tsx (all provided by the theme). - fern.config.json: bump CLI pin to 5.41.1 for global-theme support. - fern-published-branch.py + README: drop CSS-file references; document the self-injected-styles pattern. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Lawrence Lane <llane@nvidia.com>
|
MkDocs preview: https://52926f5f.dd-docs-preview.pages.dev Fern preview: https://nvidia-preview-pr-716.docs.buildwithfern.com/nemo/datadesigner
|
Code Review: PR #716 —
|
Greptile SummaryThis PR fixes the root cause of the #715 hotfix revert by re-adopting the
|
| Filename | Overview |
|---|---|
| fern/docs.yml | Adds global-theme: nvidia, drops all theme-owned fields and the entire css: list; keeps logo, navbar-links, and MDX components. Clean and correctly commented. |
| fern/scripts/fern-published-branch.py | Adds FERN_ROOT_CONFIG_PATHS, copy_required_path, and sync_fern_root_config; integrates config sync into patch_devnotes; removes deleted CSS paths from FERN_DEVNOTE_SUPPORT_PATHS. Logic is correct: versions block is preserved/normalised before and restored after copying source docs.yml. |
| fern/components/BlogCard.tsx | Moves entire blog-card/grid CSS into BLOG_CARD_CSS constant; BlogGrid injects it once per grid render. Hover border now uses var(--accent, #76b900) (theme-aware) instead of the hard-coded hex. |
| fern/components/NotebookViewer.tsx | Moves all notebook-viewer CSS into NOTEBOOK_VIEWER_CSS constant; injects once per NotebookViewer render. CSS content matches the deleted styles/notebook-viewer.css. |
| packages/data-designer/tests/docs/test_fern_published_branch.py | New test covering patch_devnotes: verifies that sync_fern_root_config copies source docs.yml/fern.config.json, strips theme-owned fields from the published copy, and correctly preserves the full versions block (including historical pinned versions). |
| fern/fern.config.json | Bumps CLI pin to 5.41.1 for global-theme support. |
Sequence Diagram
sequenceDiagram
participant Dev as Developer
participant FPB as fern-published-branch.py
participant PubBranch as Published Branch (docs-website)
participant Fern as Fern CLI (global-theme: nvidia)
Note over Dev,Fern: Full release snapshot (sync-source)
Dev->>FPB: sync-source --source-root --published-root
FPB->>PubBranch: Clear + copy entire source tree
FPB->>PubBranch: Merge/restore historical versions block
Note over PubBranch: docs.yml has global-theme:nvidia, no css: list
Note over PubBranch: All TSX components have inline CSS
Note over Dev,Fern: Incremental devnotes patch (patch-devnotes)
Dev->>FPB: patch-devnotes --source-root --published-root
FPB->>FPB: sync_fern_root_config()
FPB->>PubBranch: Copy source docs.yml + fern.config.json
FPB->>PubBranch: Restore preserved versions block
FPB->>PubBranch: Validate redirect targets
FPB->>PubBranch: Copy FERN_DEVNOTE_SUPPORT_PATHS
FPB->>PubBranch: Patch latest.yml devnotes nav block
Note over Dev,Fern: Publish
Dev->>Fern: fern publish
Fern->>Fern: Apply global-theme:nvidia
Note over Fern: Theme css: replaces local css: (intentionally none)
Fern->>PubBranch: Component style tags survive theme merge
Reviews (3): Last reviewed commit: "Merge #714 (sync Fern root config during..." | Re-trigger Greptile
- BlogCard hover uses var(--accent, #76b900) so the theme palette drives it. - Restore the explanatory CSS comments lost in the port (rmiz click-to-zoom and media margin-reset rationale; NotebookViewer section headers). - Note at each injection site that the CSS is a static string literal, so dangerouslySetInnerHTML carries no user input. - README documents why injection is intentionally unconditional (duplicate <style> tags are harmless; a render-time guard would risk SSR hydration mismatch) and points at React <style precedence> as the future dedupe path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Lawrence Lane <llane@nvidia.com>
|
Thanks for the review. Addressed in #4 — Visual smoke test (the main ask): Confirmed on the Fern preview that the self-injected CSS now loads under the global theme. On #2 — Hardcoded #3 — #5 — Lost CSS comments: Restored the explanatory comments (rmiz click-to-zoom + #1 — Duplicate |
Incorporates johnnygreco's fix so the devnote publish path syncs the updated fern/docs.yml (global-theme) and fern/fern.config.json (CLI pin) to docs-website instead of combining new support files with stale root config — required for this PR's theme migration to propagate. # Conflicts: # fern/scripts/fern-published-branch.py
|
Incorporated #714 (@johnnygreco's "sync Fern root config during devnote publish") via merge — it's a hard dependency for this PR, not just a nice-to-have. Why it's needed here: the What the merge brings in: Validation re-run after merge:
@johnnygreco — since #716 now contains your commits, we can either land #716 and close #714, or merge #714 first and I'll drop the merge here. Your call. |
📋 Summary
Re-adopts the canonical NVIDIA Fern global theme (
global-theme: nvidia) the "proper" way, fixing the root cause behind the #715 hotfix revert:cssis a theme-owned field, so under a global theme Fern replaces the child repo'scss:list with the theme's stylesheets at publish, silently dropping DataDesigner's product CSS and unstyling the Dev Notes. Instead of relying on the theme-ownedcss:field, each dev-note kit component now injects its own styles via a<style dangerouslySetInnerHTML>tag — component MDX is not theme-owned, so the styling survives the theme merge (the same approach NemoClaw uses).🔗 Related Issue
Follow-up to #713 (adopt theme) and #715 (hotfix revert).
🔄 Changes
🔧 Changed
docs.yml: addglobal-theme: nvidia; drop the theme-ownedfooter/layout/colors/theme/favicon/jsblocks and the entirecss:list; keep the partiallogooverride, GitHub navbar link, and MDX components.<style>:BlogCard/BlogGrid,Authors,NotebookViewer,MetricsTable,TrajectoryViewer, and the badge-icon rule inBadgeLinks.fern.config.json: bump CLI pin to5.41.1for global-theme support.fern-published-branch.py+README: drop CSS-file references; document the self-injected-styles pattern.🗑️ Removed
fern/main.css,fern/styles/*.css, the localNVIDIA_{dark,light,symbol}.svglogos, andCustomFooter.tsx— all now provided by the global theme.🧪 Testing
fern checkpasses (0 errors)fern docs dev)✅ Checklist
🤖 Generated with Claude Code