Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Jul 22, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue where unsupported directives are now rendered as plain text instead of causing errors or incorrect rendering.
  • Chores

    • Updated several dependencies to their latest versions for improved stability and compatibility.
    • Added a new changeset documenting the patch update.
    • Included a new documentation file with sample text for testing or reference.

@JounQin JounQin self-assigned this Jul 22, 2025
Copilot AI review requested due to automatic review settings July 22, 2025 04:43
@JounQin JounQin added the bug Something isn't working label Jul 22, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jul 22, 2025

🦋 Changeset detected

Latest commit: 8c89492

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

This PR includes changesets to release 1 package
Name Type
@alauda/doom 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 Jul 22, 2025

Walkthrough

This update introduces a patch changeset for the @alauda/doom package, improves the handling of unsupported directives in the remarkDirectives plugin by rendering them as plain text, adds a new test or documentation markdown file, and updates several dependencies in package.json.

Changes

File(s) Change Summary
.changeset/light-bears-judge.md Added a changeset documenting a patch fix for unsupported directive rendering in @alauda/doom.
fixture-docs/zh/directive.mdx Added a markdown file with a single line of Chinese text, likely for testing or documentation.
package.json Updated several dependencies to newer versions; added mdast-util-directive and mdast-util-to-markdown.
src/plugins/directives/remark-directives.ts Modified plugin to render unrecognized directives as markdown text using serialization, improving AST traversal logic.

Sequence Diagram(s)

sequenceDiagram
    participant MarkdownParser
    participant remarkDirectives
    participant AST
    participant MarkdownSerializer

    MarkdownParser->>remarkDirectives: Parse markdown with directives
    remarkDirectives->>AST: Traverse directive nodes
    AST-->>remarkDirectives: Encounter unknown directive node
    remarkDirectives->>MarkdownSerializer: Serialize unknown directive to markdown text
    MarkdownSerializer-->>remarkDirectives: Return markdown text node
    remarkDirectives->>AST: Replace unknown directive with text node
Loading

Estimated code review effort

2 (~15 minutes)

Suggested labels

dependencies

Poem

A patch for the doom, a directive anew,
If it’s not understood, plain text will do!
Dependencies rise, a doc line appears,
Markdown now smiles, no more parser tears.
🐇✨

Hopping through code, with fixes in view!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/plugins/directives/remark-directives.ts

Oops! Something went wrong! :(

ESLint: 9.31.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/lib/eslint.js' imported from /eslint.config.js
at finalizeResolution (node:internal/modules/esm/resolve:274:11)
at moduleResolve (node:internal/modules/esm/resolve:859:10)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1119e09 and 8c89492.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • .changeset/light-bears-judge.md (1 hunks)
  • fixture-docs/zh/directive.mdx (1 hunks)
  • package.json (5 hunks)
  • src/plugins/directives/remark-directives.ts (2 hunks)
🧠 Learnings (4)
📓 Common learnings
Learnt from: JounQin
PR: alauda/doom#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.
Learnt from: JounQin
PR: alauda/doom#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.
Learnt from: JounQin
PR: alauda/doom#117
File: src/remark-lint/constants.ts:1-1
Timestamp: 2025-07-09T02:31:06.588Z
Learning: In the @alauda/doom project, PUNCTUATION_REGEX in src/remark-lint/constants.ts is only used for test() operations, so the global flag is not needed and the current implementation /\p{P}/u is correct.
Learnt from: JounQin
PR: alauda/doom#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.
Learnt from: JounQin
PR: alauda/doom#34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:22:30.004Z
Learning: In the @alauda/doom project, the team prefers throwing descriptive errors for invalid configuration rather than using optional chaining or graceful fallbacks. This fail-fast approach helps catch configuration issues early during development.
Learnt from: JounQin
PR: alauda/doom#30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.339Z
Learning: JounQin has mentioned multiple times that the alauda/doom project uses yarn v4, and there are no ESLint import resolution errors for @rspress/core subpath imports.
Learnt from: JounQin
PR: alauda/doom#34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:23:34.965Z
Learning: In the @alauda/doom project, JounQin prefers concise error handling over verbose validation. While they prefer throwing on invalid configuration rather than graceful fallbacks, they don't want overly detailed validation with multiple explicit checks and error messages.
.changeset/light-bears-judge.md (6)

Learnt from: JounQin
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.

Learnt from: JounQin
PR: #117
File: src/remark-lint/constants.ts:1-1
Timestamp: 2025-07-09T02:31:06.588Z
Learning: In the @alauda/doom project, PUNCTUATION_REGEX in src/remark-lint/constants.ts is only used for test() operations, so the global flag is not needed and the current implementation /\p{P}/u is correct.

Learnt from: JounQin
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.

Learnt from: JounQin
PR: #34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:22:30.004Z
Learning: In the @alauda/doom project, the team prefers throwing descriptive errors for invalid configuration rather than using optional chaining or graceful fallbacks. This fail-fast approach helps catch configuration issues early during development.

Learnt from: JounQin
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.

Learnt from: JounQin
PR: #34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:23:34.965Z
Learning: In the @alauda/doom project, JounQin prefers concise error handling over verbose validation. While they prefer throwing on invalid configuration rather than graceful fallbacks, they don't want overly detailed validation with multiple explicit checks and error messages.

src/plugins/directives/remark-directives.ts (1)

Learnt from: JounQin
PR: #117
File: src/remark-lint/table-size.ts:8-21
Timestamp: 2025-07-09T02:31:35.615Z
Learning: GFM (GitHub Flavored Markdown) tables always have at least one row by specification, so code accessing table.children[0] in markdown AST processing is safe without additional empty table checks.

package.json (7)

Learnt from: JounQin
PR: #69
File: package.json:101-101
Timestamp: 2025-06-06T07:08:55.881Z
Learning: When a package has peer dependencies that require TypeScript (like @eslint-react/eslint-plugin), TypeScript should be moved from devDependencies to dependencies to satisfy the peer dependency requirement.

Learnt from: JounQin
PR: #69
File: package.json:101-101
Timestamp: 2025-06-06T07:08:55.881Z
Learning: When a package has peer dependencies that require TypeScript (like @eslint-react/eslint-plugin), TypeScript should be moved from devDependencies to dependencies to satisfy the peer dependency requirement.

Learnt from: JounQin
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.

Learnt from: JounQin
PR: #30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.339Z
Learning: JounQin has mentioned multiple times that the alauda/doom project uses yarn v4, and there are no ESLint import resolution errors for @rspress/core subpath imports.

Learnt from: JounQin
PR: #40
File: src/plugins/sitemap/index.ts:7-7
Timestamp: 2025-05-29T16:25:28.086Z
Learning: In @rspress/shared v2.0.0-beta.8, the '/logger' export is available in the package exports field, so imports like import { logger } from '@rspress/shared/logger' are valid even if ESLint shows resolution errors. This is used throughout the codebase in files like src/cli/translate.ts, src/cli/load-config.ts, src/utils/git.ts, and src/plugins/sitemap/index.ts.

Learnt from: JounQin
PR: #75
File: src/cli/load-config.ts:4-7
Timestamp: 2025-06-09T03:09:17.876Z
Learning: When ESLint shows "Unable to resolve path to module" errors for packages that are listed in package.json dependencies, the issue is usually that npm install hasn't been run yet, not that the packages are missing from dependencies or that there's an ESLint configuration problem.

Learnt from: JounQin
PR: #30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T08:59:41.491Z
Learning: In @rspress/core v2.0.0-beta.7, the '/theme' export is available in the package exports field as "./theme": { "default": "./theme.ts" }, so imports like import { Badge, Button } from '@rspress/core/theme' are valid even if ESLint shows resolution errors.

🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: JounQin
PR: alauda/doom#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.
Learnt from: JounQin
PR: alauda/doom#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.
Learnt from: JounQin
PR: alauda/doom#117
File: src/remark-lint/constants.ts:1-1
Timestamp: 2025-07-09T02:31:06.588Z
Learning: In the @alauda/doom project, PUNCTUATION_REGEX in src/remark-lint/constants.ts is only used for test() operations, so the global flag is not needed and the current implementation /\p{P}/u is correct.
Learnt from: JounQin
PR: alauda/doom#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.
Learnt from: JounQin
PR: alauda/doom#34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:22:30.004Z
Learning: In the @alauda/doom project, the team prefers throwing descriptive errors for invalid configuration rather than using optional chaining or graceful fallbacks. This fail-fast approach helps catch configuration issues early during development.
Learnt from: JounQin
PR: alauda/doom#30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.339Z
Learning: JounQin has mentioned multiple times that the alauda/doom project uses yarn v4, and there are no ESLint import resolution errors for @rspress/core subpath imports.
Learnt from: JounQin
PR: alauda/doom#34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:23:34.965Z
Learning: In the @alauda/doom project, JounQin prefers concise error handling over verbose validation. While they prefer throwing on invalid configuration rather than graceful fallbacks, they don't want overly detailed validation with multiple explicit checks and error messages.
.changeset/light-bears-judge.md (6)

Learnt from: JounQin
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.

Learnt from: JounQin
PR: #117
File: src/remark-lint/constants.ts:1-1
Timestamp: 2025-07-09T02:31:06.588Z
Learning: In the @alauda/doom project, PUNCTUATION_REGEX in src/remark-lint/constants.ts is only used for test() operations, so the global flag is not needed and the current implementation /\p{P}/u is correct.

Learnt from: JounQin
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.

Learnt from: JounQin
PR: #34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:22:30.004Z
Learning: In the @alauda/doom project, the team prefers throwing descriptive errors for invalid configuration rather than using optional chaining or graceful fallbacks. This fail-fast approach helps catch configuration issues early during development.

Learnt from: JounQin
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.

Learnt from: JounQin
PR: #34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:23:34.965Z
Learning: In the @alauda/doom project, JounQin prefers concise error handling over verbose validation. While they prefer throwing on invalid configuration rather than graceful fallbacks, they don't want overly detailed validation with multiple explicit checks and error messages.

src/plugins/directives/remark-directives.ts (1)

Learnt from: JounQin
PR: #117
File: src/remark-lint/table-size.ts:8-21
Timestamp: 2025-07-09T02:31:35.615Z
Learning: GFM (GitHub Flavored Markdown) tables always have at least one row by specification, so code accessing table.children[0] in markdown AST processing is safe without additional empty table checks.

package.json (7)

Learnt from: JounQin
PR: #69
File: package.json:101-101
Timestamp: 2025-06-06T07:08:55.881Z
Learning: When a package has peer dependencies that require TypeScript (like @eslint-react/eslint-plugin), TypeScript should be moved from devDependencies to dependencies to satisfy the peer dependency requirement.

Learnt from: JounQin
PR: #69
File: package.json:101-101
Timestamp: 2025-06-06T07:08:55.881Z
Learning: When a package has peer dependencies that require TypeScript (like @eslint-react/eslint-plugin), TypeScript should be moved from devDependencies to dependencies to satisfy the peer dependency requirement.

Learnt from: JounQin
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.

Learnt from: JounQin
PR: #30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.339Z
Learning: JounQin has mentioned multiple times that the alauda/doom project uses yarn v4, and there are no ESLint import resolution errors for @rspress/core subpath imports.

Learnt from: JounQin
PR: #40
File: src/plugins/sitemap/index.ts:7-7
Timestamp: 2025-05-29T16:25:28.086Z
Learning: In @rspress/shared v2.0.0-beta.8, the '/logger' export is available in the package exports field, so imports like import { logger } from '@rspress/shared/logger' are valid even if ESLint shows resolution errors. This is used throughout the codebase in files like src/cli/translate.ts, src/cli/load-config.ts, src/utils/git.ts, and src/plugins/sitemap/index.ts.

Learnt from: JounQin
PR: #75
File: src/cli/load-config.ts:4-7
Timestamp: 2025-06-09T03:09:17.876Z
Learning: When ESLint shows "Unable to resolve path to module" errors for packages that are listed in package.json dependencies, the issue is usually that npm install hasn't been run yet, not that the packages are missing from dependencies or that there's an ESLint configuration problem.

Learnt from: JounQin
PR: #30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T08:59:41.491Z
Learning: In @rspress/core v2.0.0-beta.7, the '/theme' export is available in the package exports field as "./theme": { "default": "./theme.ts" }, so imports like import { Badge, Button } from '@rspress/core/theme' are valid even if ESLint shows resolution errors.

🔇 Additional comments (7)
fixture-docs/zh/directive.mdx (1)

1-1: LGTM! Test file for directive functionality.

This test file contains directive-like syntax that will help verify the new behavior where unsupported directives are rendered as plain text instead of being processed or causing errors.

.changeset/light-bears-judge.md (1)

1-5: LGTM! Proper changeset documentation.

The changeset correctly documents this as a patch-level fix with a clear description that matches the PR objectives.

package.json (3)

86-86: Required dependency for directive serialization.

The mdast-util-directive package is correctly added to support the new functionality that serializes directive nodes back to markdown text.


90-90: Required dependency for markdown serialization.

The mdast-util-to-markdown package is correctly added to support the toMarkdown function used in the directive handling logic.


63-63: Routine dependency updates.

The dependency version updates appear to be routine maintenance to keep packages current. All updates are minor/patch versions which should be safe.

Also applies to: 73-73, 117-117, 124-124, 138-138, 142-143

src/plugins/directives/remark-directives.ts (2)

2-3: Required imports for directive serialization.

The new imports support the functionality to serialize directive nodes back to markdown text, which is essential for the fix.


9-9: Updated visit callback signature.

The callback now correctly receives index and parent parameters needed for the node replacement logic.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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 the handling of unsupported directives by rendering them as text instead of silently ignoring them. The key changes include updating the directive processing logic to convert unsupported directives to markdown text, adding required dependencies, and including a test fixture.

  • Updates the remark directive plugin to convert unsupported directives to text nodes using markdown utilities
  • Adds mdast-util-directive and mdast-util-to-markdown dependencies for directive-to-text conversion
  • Various dependency version updates for maintenance

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/plugins/directives/remark-directives.ts Modified to render unsupported directives as text instead of returning early
package.json Added new dependencies and updated existing package versions
fixture-docs/zh/directive.mdx Added test fixture for directive handling

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

pkg-pr-new bot commented Jul 22, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/@alauda/doom@136.tgz

commit: af1f513

@JounQin JounQin merged commit f85e1be into main Jul 22, 2025
16 checks passed
@JounQin JounQin deleted the fix/unsupported_directives branch July 22, 2025 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants