Skip to content

How to change font-style of comments in code block? #2345

Answered by sharpchen
gyhyfj asked this question in Q&A
Discussion options

You must be logged in to vote

Do you mean code block in rendered markdown?

This is specified by textmate rules from xx.json. Vitepress uses shikiji to perform highlighting(built-in themes are also from shikiji). This is my solution.

  • First, get the theme represented as json you desired. If you are using built-in themes from shikiji you can find them in node_modules\shikiji\dist\themes\*.mjs. The anon object in the module is the presentation of the theme. No matter what method you take, make it a json and include it in your project.
  • Then find "scope": "comment" in your json like this, add or change the fontStyle. (To make it normal, delete the fontStyle property)
{
   "scope": "comment",
   "settings": {
       "foreg…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gyhyfj
Comment options

Answer selected by gyhyfj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants