How do I make all HTML attributes italicized in VSCode? Is it possible?

Viewed 1251

Thanks for helping. How do I make all HTML attributes (ie the word type=), italicized in VSCode? Is it possible? I meant like to change the theme. You know how some themes have italicized attributes? type=, class=, id=, I just want these guys italicized in the theme.

2 Answers

VS Code's syntax color themes can specify a fontStyle in addition to the color of syntax scopes. To make text italic, you'd want to set "fontStyle": "italic"

This example editor.tokenColorCustomizations setting uses fontStyle to make some html attributes italic:

"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "entity.other.attribute-name",
            "settings": {
                "fontStyle": "italic"
            }
        }
    ]
}

Here's an example of how to set fontStyle in an actual color theme.

entity.other.attribute-name is only an example scope. You may need to tweak the scope or style multiple scopes based on your specific needs

you can use the tag <i>inert italicized content here</i> example:

`<!DOCTYPE html>
 <html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <i>this stuff is italicized</i>
  </body>
</html>`

another good tag is <em></em> used to emphasize the tags. Here's a great website I like to use.

edit: here

Related