Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Format Selection As HTMLNew to Visual Studio Code? Get it now.
Format Selection As HTML

Format Selection As HTML

Adrian Wilczyński

|
108,998 installs
| (4) | Free
Format selected text as HTML using js-beautify or Prettier. Useful for code embedded in strings or templating languages without formatting support (like Razor).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Format Selection As HTML

Format selected text as HTML using js-beautify or Prettier. Useful for code embedded in strings or templating languages without formatting support (like Razor).

Instruction

Use Format Selection As HTML command from context menu or Command Palette.

Presentation

Example

Configuration

  • formatSelectionAsHtml.formatter - formatter to use: prettier or js-beautify;
  • formatSelectionAsHtml.htmlWhitespaceSensitivity - Prettier Whitespace Sensitivity setting.
  • formatSelectionAsHtml.preserveNewlines - Beautify Preserve Newlines setting.
  • formatSelectionAsHtml.maxPreserveNewlines - Beautify Max Preserve Newlines setting.
  • formatSelectionAsHtml.printWidth - maximum amount of characters per line.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft