benweet/stackedit.js

JavaScriptbenweet.github.io/stackedit.js/

Add StackEdit to any website

markdownmarkdown-editorstackediteditor
Sterne-Wachstum
Sterne
1.2k
Forks
129
Wochenwachstum
+-1
Issues
23
5001k
Jan. 2023Apr. 2024Juli 2025Okt. 2026
Artefaktenpm
README

stackedit.js

Build Status NPM version

Add StackEdit to any website

Build setup

# install dependencies
npm install

# watch and build for dev
npm run dev

# build for production
npm run build

Quick start

Bind StackEdit to a textarea:

// Import the lib.
import Stackedit from 'stackedit-js';

// Get the textarea.
const el = document.querySelector('textarea');

// Create the Stackedit object.
const stackedit = new Stackedit();

// Open the iframe
stackedit.openFile({
  name: 'Filename', // with a filename
  content: {
    text: el.value // and the Markdown content.
  }
});

// Listen to StackEdit events and apply the changes to the textarea.
stackedit.on('fileChange', (file) => {
  el.value = file.content.text;
});

Documentation

Full documentation can be found at https://benweet.github.io/stackedit.js/.