Skip to content

A powerful extension for Monaco editor that supports JavaScript and CSS features in HTML and more.

Notifications You must be signed in to change notification settings

huanent/monaco-editor-ex

Repository files navigation

monaco-editor-ex

monaco-editor-ex is a powerful monaco-editor extension.

Many features that are only available in vscode are brought to monaco-editor,try it now! online demo

available features

html

  • javascript and style tag code completion
  • style color preview and edit
  • auto close tag
  • Better format
  • unocss support

Usage

Html

<div
  id="container"
  style="width:800px;height:600px;border:1px solid grey"
></div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/min/vs/loader.js"></script>
<script src="https://cdn.jsdelivr.net/npm/monaco-editor-ex@latest/dist/monaco-editor-ex.iife.js"></script>
<script>
  require.config({
    paths: { vs: "https://cdn.jsdelivr.net/npm/[email protected]/min/vs" },
  });
  require(["vs/editor/editor.main"], function () {
    MonacoEditorEx.useMonacoEx(monaco);
    var editor = monaco.editor.create(document.getElementById("container"), {
      value: `<div><div>`,
      language: "html",
    });
  });
</script>

Vite

npm i monaco-editor
npm i monaco-editor-ex

Add "userWorker.ts" file to project

import "./userWorker";
import * as monaco from "monaco-editor";
import { useMonacoEx } from "monaco-editor-ex";

useMonacoEx(monaco);

About

A powerful extension for Monaco editor that supports JavaScript and CSS features in HTML and more.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published