This is a React component for a rich text editor that can read and write CommonMark Markdown text. The editor uses Slate.js.
The editor is plugin based and includes a pop-up formatting toolbar.
This component is Apache-2 licensed Open Source. Contributors welcome!
https://accordproject-markdown-editor.netlify.com/examples/
npm install @accordproject/markdown-editor
import { MarkdownEditor } from '@accordproject/markdown-editor';
import List from '../../src/plugins/list';
import Video from '../../src/plugins/video';
const plugins = [List(), Video()];
function storeLocal(editor) {
localStorage.setItem('markdown-editor', editor.getMarkdown());
}
ReactDOM.render(<MarkdownEditor plugins={plugins} onChange={storeLocal} />, document.getElementById('root'));
For an example React App see the ./examples/ folder.
A TextArea
containing CommonMark synchronized with a MarkdownEditor
component, rendered using Slate.js.
The code for the sample video
plugin used in the demo is here:
https://github.com/accordproject/markdown-editor/blob/master/src/plugins/video.js
Run npm start
and then navigate to: http://localhost:3001/examples
In the project directory, you can run:
Runs the app in the development mode.
Open [http://localhost:3001](http://localhost:30001 to view it in the browser.
The page will reload if you make edits.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!