Skip to content
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

feat: add codeBlockTitle option support for highlighter, close #379 #386

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

pengzhanbo
Copy link
Member

@pengzhanbo pengzhanbo commented Mar 4, 2025

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Provide a description in this PR that addresses what the PR is solving. If this PR is going to solve an existing issue, please reference the issue (e.g. close #123).

What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Other

Description

close #379

Screenshots

QQ_1741079980083

@coveralls
Copy link

coveralls commented Mar 4, 2025

Pull Request Test Coverage Report for Build 13650372217

Details

  • 2 of 6 (33.33%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.1%) to 59.477%

Changes Missing Coverage Covered Lines Changed/Added Lines %
plugins/markdown/plugin-prismjs/src/node/prepareClientConfigFile.ts 0 2 0.0%
plugins/markdown/plugin-prismjs/src/node/prismjsPlugin.ts 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
plugins/markdown/plugin-prismjs/src/node/prepareClientConfigFile.ts 1 1.72%
Totals Coverage Status
Change from base Build 13585771814: -0.1%
Covered Lines: 1358
Relevant Lines: 2059

💛 - Coveralls

@Mister-Hope
Copy link
Member

Mister-Hope commented Mar 4, 2025

Actually I would prefer the vitepress style, code title should be expanded to full width, otherwise it would be very confusing when combining with tabs or code tabs.

Besides, icon support could be added here, similar styles can be found in VitePress default theme, supporting by --icon

Copy link
Member

@Mister-Hope Mister-Hope left a comment

Choose a reason for hiding this comment

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

See comment

@pengzhanbo
Copy link
Member Author

Besides, icon support could be added here, similar styles can be found in VitePress default theme, supporting by --icon

Regarding support for icons, I have added the attribute data-title="xxx" to the tags, but I do not intend to provide default styles for it; this part will be customized by theme developers or users through CSS extensions. It also supports passing a render(title, code) function to customize the rendering of code block titles.

@Mister-Hope Mister-Hope merged commit 7535e36 into main Mar 4, 2025
34 checks passed
@Mister-Hope Mister-Hope deleted the code-block-title branch March 4, 2025 15:50
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.

[Feature request] Improve code block title appearance
3 participants