
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
emmet-monaco-es
Advanced tools
Emmet Support for Monaco Editor, based on vscode-emmet-helper
$ npm install emmet-monaco-es
The emmet functionality was bound to language features not to a specific editor instance.
emmetHTML works for HTML compatible languages, like PHP, for html only by defaultemmetCSS works for CSS compatible languages, like LESS / SCSS, for css only by defaultemmetJSX works for JSX compatible languages, like JavaScript / TypeScript / MDX, for javascript only by defaultFollow this guide to make Monaco Editor support TSX
Initialize emmet should BEFORE all monaco editor instance creation
import { emmetHTML, emmetCSS, emmetJSX, expandAbbreviation, registerCustomSnippets } from 'emmet-monaco-es'
// `emmetHTML` , `emmetCSS` and `emmetJSX` are used the same way
const dispose = emmetHTML(
// monaco-editor it self. If not provided, will use window.monaco instead.
// This could make the plugin support both ESM and AMD loaded monaco-editor
monaco,
// languages needs to support html markup emmet, should be lower case.
['html', 'php'],
)
// run it if you want to dispose emmetHTML.
// NOTE: all languages specified will be disposed.
dispose()
// internal expand API, if you want to extend functionality with emmet
// check out the emmet repo https://github.com/emmetio/emmet for how to use it
expandAbbreviation('a', { type: 'markup', syntax: 'html' }) // <a href=""></a>
expandAbbreviation('fz14', { type: 'stylesheet', syntax: 'css' }) // font-size: 14px;
// register custom snippets
registerCustomSnippets('html', {
ull: 'ul>li[id=${1} class=${2}]*2{ Will work with html, pug, haml and slim }',
oll: '<ol><li id=${1} class=${2}> Will only work in html </ol>',
ran: '{ Wrap plain text in curly braces }',
})
<script src="https://unpkg.com/emmet-monaco-es/dist/emmet-monaco.min.js"></script>
<script>
// NOTE: monaco-editor should be loaded first
// see the above esm example for details
emmetMonaco.emmetHTML(monaco)
</script>
By default, emmet-monaco-es uses Monaco's built-in Monarch tokenizer to detect valid abbreviation locations. When using an external syntax highlighter (e.g. shiki), Monarch tokens are unavailable, and emmet will not work correctly.
Pass { tokenizer: 'standard' } as the options argument to use Monaco's StandardTokenType API instead:
emmetHTML(monaco, ['html'], { tokenizer: 'standard' })
emmetCSS(monaco, ['css'], { tokenizer: 'standard' })
emmetJSX(monaco, ['javascript'], { tokenizer: 'standard' })
Does NOT support Emmet for embed CSS inside HTML / JSX / TSX
MIT
FAQs
emmet plugin for monaco-editor
The npm package emmet-monaco-es receives a total of 3,109 weekly downloads. As such, emmet-monaco-es popularity was classified as popular.
We found that emmet-monaco-es demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.