-
Notifications
You must be signed in to change notification settings - Fork 304
fix(site): rewrite the theme of code highlight #3397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis update enhances code syntax highlighting in markdown and Vue components for a documentation site. It introduces language-specific dark mode styles, adds TypeScript highlighting support, and simplifies code highlighting logic by switching from a Changes
Sequence Diagram(s)sequenceDiagram
participant DemoVue as demo.vue
participant AsyncHighlight as async-highlight.vue
participant HLJS as highlight.js
DemoVue->>AsyncHighlight: Passes code and filename props
AsyncHighlight->>AsyncHighlight: Checks if filename ends with ".vue"
alt .vue file
AsyncHighlight->>HLJS: Highlight code as HTML
else other file
AsyncHighlight->>HLJS: highlightAuto(code)
end
HLJS-->>AsyncHighlight: Returns highlighted HTML
AsyncHighlight-->>DemoVue: Renders highlighted code block
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🔇 Additional comments (10)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Walkthrough此PR主要调整了官网的暗色代码高亮主题,统一示例代码的高亮格式为XML,并在多个文件中更新了代码高亮的样式和逻辑。 Changes
|
} else if (props.types && props.types === 'ts') { | ||
highlightCode.value = getFormatCodes(props.types) | ||
if (props.filename && props.filename.endsWith('.vue')) { | ||
highlightCode.value = hljs.highlight(props.code, { language: 'html' }).value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of specific TypeScript handling in favor of automatic language detection could potentially lead to incorrect highlighting if the automatic detection fails. Consider verifying that this change does not affect the accuracy of TypeScript code highlighting.
PR
1、调整官网的暗色代码高亮的颜色



示例代码 & 指南的代码
2、 示例代码统一用xml格式高亮
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information