Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>wrapper htmlNew to Visual Studio Code? Get it now.
wrapper html

wrapper html

Spikey

|
1,793 installs
| (3) | Free
Wrap, unwrap and rename HTML and JSX tags with proper indentation. Type any tag Emmet-style, like div.card#main.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Wrapper HTML

Install the extension from here

Developed By

  • Avishkar Mahalingpure
  • Harsh Bailurkar

Demo Video

https://github.com/user-attachments/assets/8dc17ec9-7bf7-4803-b850-2b9e524fbc60

Features

Wrapper HTML wraps, unwraps and renames HTML and JSX tags while keeping your indentation tidy. Closing tags are always handled for you.

Wrap with Tag (Ctrl+1, or Ctrl+Cmd+W on macOS)

  • Select text and press the shortcut to wrap exactly that selection.
  • No selection? The element around the cursor is wrapped, including its closing tag, even when it spans many lines.
  • Tags are never split. If your selection would cut a tag in half, it is widened so every tag stays whole and paired:
You select What gets wrapped
world in <p>Hello world</p> Just world
div in <div class="box"> (e.g. by double-clicking it) The whole <div class="box">…</div> element
Part of an attribute, like class="box" The whole element
div in a closing </div> The whole element
From the middle of one <li> to the middle of the next Both <li> elements, complete
  • Pick a common tag from the list, or type any tag Emmet-style:
You type You get
section <section>
div.card.wide#main <div id="main" class="card wide">
.wrapper <div class="wrapper">
button[type=submit disabled] <button type="submit" disabled>
a[href="/docs" target=_blank] <a href="/docs" target="_blank">
my-element <my-element>
  • Your recently used tags appear at the top of the list.
  • Multi-line content is placed on its own lines and indented one level, using your editor's tab/space settings.

Remove Tag (Unwrap)

Removes the element around the cursor and keeps its content, outdenting it to fit.

Rename Tag

Renames the element around the cursor, updating the opening and closing tags together.

JSX, Vue and Svelte

  • In .jsx / .tsx files, classes are written as className, and <> wraps in a fragment.
  • Tag matching understands {expressions} in attributes, comments, <script>/<style> blocks, self-closing and void elements (<br>, <img>).

Usage

  • Keyboard: Ctrl+1 wraps (Ctrl+Cmd+W / ⌃⌘W on macOS, where Ctrl+1 switches desktops). Unwrap and Rename have no default shortcut, so you can bind keys you like (see below).
  • Right-click menu: in HTML, JSX, Vue, Svelte, Astro, PHP and other template files, right-click → Wrapper HTML.
  • Command Palette: Ctrl+Shift+P / Cmd+Shift+P, then type Wrapper HTML.

Keyboard shortcuts

Command Windows / Linux macOS
Wrap with Tag Ctrl+1 Ctrl+Cmd+W (⌃⌘W)
Remove Tag (Unwrap) not set not set
Rename Tag not set not set

Only Wrap has a default shortcut. Below is how to set or change any of them.

Option 1: the Keyboard Shortcuts editor (any OS)

  1. Open Keyboard Shortcuts:
    • Windows / Linux: Ctrl+K then Ctrl+S, or File → Preferences → Keyboard Shortcuts
    • macOS: Cmd+K then Cmd+S, or Code → Settings → Keyboard Shortcuts
  2. Search for Wrapper HTML.
  3. Double-click a command, press the keys you want, then press Enter.

If the keys are already used by something else, VS Code lists it under the command. Right-click it and choose Show Same Keybindings.

Option 2: keybindings.json

Open the Command Palette (Ctrl+Shift+P on Windows / Linux, Cmd+Shift+P on macOS) and run Preferences: Open Keyboard Shortcuts (JSON). The file lives here:

OS Location
Windows %APPDATA%\Code\User\keybindings.json
macOS ~/Library/Application Support/Code/User/keybindings.json
Linux ~/.config/Code/User/keybindings.json

Add the entries for your OS inside the [ ]. "when": "editorTextFocus" means the shortcut only works while you are typing in an editor, so it won't affect the terminal or other panels.

macOS

[
  { "key": "ctrl+cmd+w", "command": "html-wrapper.wrapper", "when": "editorTextFocus" },
  { "key": "ctrl+cmd+u", "command": "html-wrapper.unwrap", "when": "editorTextFocus" },
  { "key": "ctrl+cmd+r", "command": "html-wrapper.rename", "when": "editorTextFocus" }
]

Windows

[
  { "key": "ctrl+1", "command": "html-wrapper.wrapper", "when": "editorTextFocus" },
  { "key": "ctrl+alt+u", "command": "html-wrapper.unwrap", "when": "editorTextFocus" },
  { "key": "ctrl+alt+r", "command": "html-wrapper.rename", "when": "editorTextFocus" }
]

Linux

[
  { "key": "ctrl+1", "command": "html-wrapper.wrapper", "when": "editorTextFocus" },
  { "key": "ctrl+alt+u", "command": "html-wrapper.unwrap", "when": "editorTextFocus" },
  { "key": "ctrl+alt+r", "command": "html-wrapper.rename", "when": "editorTextFocus" }
]

These are suggestions. Any keys work as long as they don't clash with something you use.

Wrap with a fixed tag, skipping the picker (any OS, change the key to suit):

{ "key": "ctrl+alt+d", "command": "html-wrapper.wrapper", "args": { "tag": "div.container" }, "when": "editorTextFocus" }

Rename straight to a given tag:

{ "key": "ctrl+alt+s", "command": "html-wrapper.rename", "args": { "name": "section" }, "when": "editorTextFocus" }

To turn off the default Wrap shortcut, add the same entry with a - in front of the command, e.g. { "key": "ctrl+1", "command": "-html-wrapper.wrapper" }.

Shortcut conflicts by OS

  • macOS: Ctrl+1 switches to Desktop 1 when System Settings → Keyboard → Keyboard Shortcuts → Mission Control → Switch to Desktop 1 is on, which is why the default on macOS is ⌃⌘W. Window managers such as Rectangle use many Ctrl+Option shortcuts, so Ctrl+Cmd is usually safer.
  • Windows: on some keyboard layouts (German, Polish, etc.), Ctrl+Alt works like AltGr, which types special characters. If a Ctrl+Alt shortcut stops you typing a character, pick Ctrl+Shift+Alt instead.
  • Linux: desktops such as GNOME and KDE reserve some Ctrl+Alt keys (for example Ctrl+Alt+T opens a terminal and Ctrl+Alt+arrows switch workspaces). If a shortcut does nothing in VS Code, check your desktop's keyboard settings.
  • Settings Sync: VS Code keeps keybindings separate per OS by default, so a Mac setup won't overwrite your Windows or Linux shortcuts.

Release Notes

v2.1.0

  • Type any tag as an Emmet-style abbreviation (div.card#main, button[type=submit])
  • New Remove Tag (Unwrap) and Rename Tag commands
  • Recently used tags appear first in the picker
  • JSX support: className and <> fragments
  • Right-click menu entry in HTML and template files
  • Reliable tag matching across lines, comments, scripts, quoted attributes and JSX expressions
  • Fixed: a selection is now wrapped as selected, instead of wrapping the surrounding element
  • Selections never split a tag: selecting a tag name (e.g. double-clicking div) wraps the whole element, and partial selections grow to include complete elements
  • Fixed: indented elements are no longer over-indented, and your editor's indentation settings are respected

v2.0.1

  • Added smart indentation support for better code formatting
  • Improved tag matching for nested HTML structures
  • Added support for HTML attributes (like href for anchor tags)
  • Enhanced error handling and user feedback
  • Better handling of long documents and complex HTML structures
  • Improved formatting preservation for both single-line and multi-line content

Installation

Open Visual Studio Code. In the Extension Store search wrapper html. or download it from here https://marketplace.visualstudio.com/items?itemName=Spikey.wrapper-html

if the keys are conflicting then change them as given below: Go to the "View" menu and select "Command Palette" (or use the shortcut Ctrl+Shift+P or Cmd+Shift+P on macOS). Type "Preferences: Open Keyboard Shortcuts (JSON)" and select it from the dropdown. In the keybindings.json file, add your custom key binding as shown above. Enjoy your streamlined HTML wrapping experience!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft