A Markdown editor you can just drop in
<tint-editor> is one custom element that works in any stack (plain HTML,
Datastar, htmx, Alpine.js or a bundler) with one script and no build step.
<script type="module" src="https://cdn.jsdelivr.net/npm/tint-editor@0.1.0/tint-editor.js"></script>
<tint-editor name="body" aria-label="Markdown"></tint-editor>Works like a form field
Form-associated via ElementInternals: name, required, FormData and form reset just work.
One file, no build step
One ES module with styles and markdown-actions built in. Load it from a script tag or from npm.
Links and images
Insert by URL, add alt text, and undo the insertion in one step.
Your design system
Customize the editor with --te-* CSS variables. It follows the page’s color scheme.
Your toolbar
Arrange the buttons you need, or hide the toolbar and build your own with editor.exec().
CommonMark source
A native textarea keeps your Markdown as source, with the browser’s own selection and undo.
Three steps
Load one script, add the field to a form, and save the Markdown.
1. Load it
<script type="module" src="/tint-editor.js"></script>For npm and CDN options, see Installation.
2. Use it
<form method="post" action="/posts">
<tint-editor name="body" aria-label="Markdown" required></tint-editor>
<button type="submit">Save</button>
</form>3. Read the source
// Go: read the submitted Markdown
body := r.FormValue("body")See Forms & validation.