Lightweight HTML editing with images, tables and source mode. Zero runtime dependencies.
All four libraries · HTML editor skins · Markdown editor · Markdown parser · Syntax highlighter
Format text, insert images, edit tables, or work directly in HTML source. The browser owns selection and undo. Your application owns persistence and uploads.
Type to edit. Select text and use the toolbar. Paste, drop, or insert images with the image button.
A second editor with a trimmed toolbar. Its image handler uploads files through a custom hook. This demo returns a base64 data URI; a real upload would return the server's image URL.
This editor runs with rawMode: true: pasted or
imported HTML skips sanitization. Use it only when you sanitize
the HTML yourself — for example, right after a Source edit or
from content you already control.
Copy the prebuilt CSS and JavaScript beside your page. No build step is required.
<link rel="stylesheet" href="lightmetal.css">
<div id="editor" class="lightmetal"></div>
<script src="lightmetal.js"></script>
<script>
const editor = lightmetal.init({
element: document.getElementById('editor'),
onChange: html => console.log(html)
});
editor.setHTML('<p>Hello, ligHTMetaL!</p>');
</script>
Read content with editor.getHTML() and call editor.destroy() when removing the editor. Choose toolbar controls with the actions option.
Use a maintained HTML sanitizer before rendering or publishing untrusted content. The editor filters HTML imports by default; Source edits and raw mode give your application direct control over HTML.