Content

Feature origin: Tint

Tint keeps CommonMark as source. It does not parse or reserialize the document.

Initial content

Set the value attribute in HTML or defaultValue in JavaScript. The default is restored by form reset and updates the live value while the editor is pristine.

<tint-editor aria-label="Markdown" value="# A new draft"></tint-editor>

Reading and writing

editor.value is the current Markdown. Assignments are silent and leave the reset value alone. As with a native textarea, JavaScript values use LF line endings.

const markdown = editor.value;
editor.value = "# Restored draft";

Showing Markdown

Use a readonly Tint field when readers need the source. When displaying saved text in other HTML elements, set textContent or escape it on the server.