Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Dec 18, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Fixed PDF export styling inconsistencies. Improved rendering of table-of-contents elements and print mode display to ensure accurate document layout and visual appearance.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 18, 2025 15:50
@changeset-bot
Copy link

changeset-bot bot commented Dec 18, 2025

🦋 Changeset detected

Latest commit: b3ab859

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@alauda/doom Patch
@alauda/doom-export Patch

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

This PR fixes PDF export styling by renaming selectors from rspress to rp across configuration and stylesheets, introducing an outlineExcludeSelector parameter to filter TOC elements from PDF outline extraction, updating print mode styling rules, and modifying auto-toc class naming for consistency.

Changes

Cohort / File(s) Summary
Changeset
.changeset/red-spiders-wonder.md
Added patch-level changeset for @alauda/doom and @alauda/doom-export with fix note "fix: exporting pdf style"
Export Configuration & Styling
packages/doom/src/cli/export.ts, packages/doom/src/plugins/auto-toc/remark-auto-toc.ts, packages/doom/styles/global.scss
Updated outline container selector from .rspress-doc to .rp-doc, added outlineExcludeSelector for .rp-toc-exclude filtering; changed auto-toc className from rspress-toc-exclude to rp-toc-exclude; renamed print mixin selectors from .rspress to .rp, updated active TOC text styling and removed marker-related rules
PDF Outline Extraction
packages/export/src/html-export-pdf/core/outline.ts
Added optional outlineExcludeSelector parameter to getOutlineNodes() with exclusion filtering logic to skip outline tags matching the selector; threaded parameter through DOM evaluation context
PDF Printer Options
packages/export/src/html-export-pdf/core/printer.ts
Added outlineExcludeSelector field to PrinterOptions interface and private member to Printer class; constructor now initializes field and forwards parameter to getOutlineNodes()

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Pay attention to packages/doom/styles/global.scss: Multiple selector renames and styling rule changes; verify all CSS refactoring is applied consistently
  • Verify that outlineExcludeSelector parameter is correctly threaded through the outline extraction call chain in outline.ts and printer.ts
  • Confirm selector rename consistency across all files (.rspress.rp, rspress-toc-excluderp-toc-exclude)

Possibly related PRs

Suggested labels

bug

Poem

🐰 Hop hop, the outlines dance
Selectors renamed in PDF's trance
No more TOC in the printed sight,
Just clean exports, styled just right!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the changeset—fixing PDF export styling by updating selectors and improving outline/TOC handling across multiple components.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/export_style

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4497634 and b3ab859.

📒 Files selected for processing (6)
  • .changeset/red-spiders-wonder.md (1 hunks)
  • packages/doom/src/cli/export.ts (1 hunks)
  • packages/doom/src/plugins/auto-toc/remark-auto-toc.ts (1 hunks)
  • packages/doom/styles/global.scss (1 hunks)
  • packages/export/src/html-export-pdf/core/outline.ts (4 hunks)
  • packages/export/src/html-export-pdf/core/printer.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,ts,tsx,jsx,json,yml,yaml,md}

📄 CodeRabbit inference engine (AGENTS.md)

Format code with Prettier according to the project's Prettier configuration

Files:

  • packages/doom/src/plugins/auto-toc/remark-auto-toc.ts
  • packages/doom/src/cli/export.ts
  • packages/export/src/html-export-pdf/core/printer.ts
  • packages/export/src/html-export-pdf/core/outline.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript strict mode for type safety

Files:

  • packages/doom/src/plugins/auto-toc/remark-auto-toc.ts
  • packages/doom/src/cli/export.ts
  • packages/export/src/html-export-pdf/core/printer.ts
  • packages/export/src/html-export-pdf/core/outline.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Follow ESLint rules defined in eslint.config.js

Files:

  • packages/doom/src/plugins/auto-toc/remark-auto-toc.ts
  • packages/doom/src/cli/export.ts
  • packages/export/src/html-export-pdf/core/printer.ts
  • packages/export/src/html-export-pdf/core/outline.ts
🧠 Learnings (5)
📚 Learning: 2025-07-09T02:33:05.638Z
Learnt from: JounQin
Repo: alauda/doom PR: 117
File: src/remark-lint/no-heading-punctuation.ts:4-4
Timestamp: 2025-07-09T02:33:05.638Z
Learning: In the alauda/doom project, JounQin prefers to keep the `toString` import from `mdast-util-to-string` as is, even though it shadows the global toString property. Variable shadowing warnings for this specific case should not be flagged as issues.

Applied to files:

  • packages/doom/src/plugins/auto-toc/remark-auto-toc.ts
  • .changeset/red-spiders-wonder.md
📚 Learning: 2025-10-30T06:51:00.220Z
Learnt from: JounQin
Repo: alauda/doom PR: 202
File: packages/doom/styles/login.module.scss:1-14
Timestamp: 2025-10-30T06:51:00.220Z
Learning: In CSS Modules (files with .module.css or .module.scss extension), class selectors are locally scoped by default unless explicitly wrapped in :global(). When reviewing selectors like body:has(.someClass) in CSS Module files, remember that .someClass will be transformed to a unique hashed class name, preventing conflicts with other files.

Applied to files:

  • packages/doom/styles/global.scss
📚 Learning: 2025-05-26T09:09:21.339Z
Learnt from: JounQin
Repo: alauda/doom PR: 30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.339Z
Learning: The alauda/doom project uses yarn v4 for dependency management, which handles package exports and module resolution correctly, so imports like `rspress/core/theme` work without any ESLint errors.

Applied to files:

  • .changeset/red-spiders-wonder.md
📚 Learning: 2025-12-15T10:50:06.727Z
Learnt from: CR
Repo: alauda/doom PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-15T10:50:06.727Z
Learning: Organize code in monorepo structure with workspaces: main tool in packages/doom/, export functionality in packages/export/, documentation in docs/, and test documentation in fixture-docs/

Applied to files:

  • .changeset/red-spiders-wonder.md
📚 Learning: 2025-06-09T03:10:41.010Z
Learnt from: JounQin
Repo: alauda/doom PR: 75
File: src/cli/load-config.ts:4-7
Timestamp: 2025-06-09T03:10:41.010Z
Learning: The alauda/doom project uses yarn v4 as the package manager, not npm. Always reference yarn commands when suggesting package management operations.

Applied to files:

  • .changeset/red-spiders-wonder.md
🔇 Additional comments (8)
.changeset/red-spiders-wonder.md (1)

1-6: LGTM!

The changeset correctly documents patch-level updates for both affected packages with a clear description of the fix.

packages/doom/styles/global.scss (1)

140-157: LGTM! Well-coordinated naming standardization.

The print mixin updates consistently migrate from rspress to rp naming conventions and adopt a clearer doc-layout naming scheme. The GitHub issue reference for the min-height: unset workaround is excellent documentation practice.

packages/doom/src/cli/export.ts (1)

122-123: LGTM! Selector updates align with naming convention.

The outline selectors have been correctly updated to use the rp- prefix and introduce exclusion filtering for TOC elements. This integrates well with the className changes in remark-auto-toc.ts and the filtering logic in outline.ts.

packages/doom/src/plugins/auto-toc/remark-auto-toc.ts (1)

35-35: LGTM! className updated to match new naming convention.

The change from rspress-toc-exclude to rp-toc-exclude aligns with the broader naming standardization and enables the PDF export outline exclusion mechanism introduced in this PR.

packages/export/src/html-export-pdf/core/printer.ts (2)

41-41: LGTM! Clean API extension.

The optional outlineExcludeSelector parameter is properly typed and maintains backward compatibility.


62-62: LGTM! Proper initialization and threading.

The outlineExcludeSelector is correctly initialized with a safe default (empty string) and properly forwarded to getOutlineNodes. The implementation maintains consistency with the existing outlineContainerSelector pattern.

Also applies to: 97-97, 275-275

packages/export/src/html-export-pdf/core/outline.ts (2)

76-76: LGTM! Clean API extension with proper parameter threading.

The outlineExcludeSelector parameter is properly added to the function signature and correctly threaded through the evaluation context, maintaining consistency with the existing outlineContainerSelector pattern.

Also applies to: 80-80, 153-153


100-102: LGTM! Effective filtering implementation.

The exclusion logic correctly uses tag.matches() with short-circuit evaluation to filter out elements matching the selector. The descendant selector .rp-toc-exclude * will properly match heading elements nested within the auto-TOC wrapper div.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: JounQin <admin@1stg.me>
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 18, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/@alauda/doom@223.tgz
yarn add https://pkg.pr.new/@alauda/doom-export@223.tgz

commit: b3ab859

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes PDF export styling by updating CSS class names from rspress prefixes to rp prefixes and adds support for excluding specific elements from PDF outlines. The changes ensure proper styling during PDF export and allow filtering of table of contents items.

Key changes:

  • Added outlineExcludeSelector option to filter elements from PDF outlines
  • Updated CSS class selectors from rspress-* to rp-* to match current framework conventions
  • Fixed print media query styling to hide navigation and sidebars correctly

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/export/src/html-export-pdf/core/printer.ts Added outlineExcludeSelector property to printer options and configuration
packages/export/src/html-export-pdf/core/outline.ts Implemented filtering logic to exclude elements matching the exclude selector from outlines
packages/doom/styles/global.scss Updated CSS class names from rspress-* to rp-* and refined print media query styles
packages/doom/src/plugins/auto-toc/remark-auto-toc.ts Changed class name from rspress-toc-exclude to rp-toc-exclude
packages/doom/src/cli/export.ts Updated outline container selector and added exclude selector configuration
.changeset/red-spiders-wonder.md Added changeset for patch release

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JounQin JounQin merged commit 4d78da5 into main Dec 18, 2025
14 checks passed
@JounQin JounQin deleted the fix/export_style branch December 18, 2025 15:57
github-actions bot pushed a commit that referenced this pull request Dec 18, 2025
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.

2 participants