Alpine.js
Alpine.js
Bind the Markdown both ways with x-model.
Current Markdown source
Integration code
<div x-data="{ seed: '# Alpine.js\n\nEdit this Markdown or replace it from Alpine state.', body: '' }"
x-init="body = seed">
<label class="editor-label" for="draft">Markdown</label>
<tint-editor id="draft" rows="6" x-model="body"></tint-editor>
<div class="row">
<button type="button" @click="body = seed">Reset</button>
<button type="button" @click="body = '## Replaced\n\nSet from Alpine state.'">Replace content</button>
<button type="button" @click="body = ''">Clear</button>
<span class="hint" x-text="body.length + ' characters'"></span>
</div>
</div>The editor runs the code shown in the Code tab, with the setup from the guide. See generic examples for framework-free snippets.