Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @accordproject/markdown-editor with all npm packages installed. Try it out:

require("react/package.json"); // react is a peer dependency. require("react-dom/package.json"); // react-dom is a peer dependency. require("slate/package.json"); // slate is a peer dependency. require("slate-history/package.json"); // slate-history is a peer dependency. require("slate-react/package.json"); // slate-react is a peer dependency. require("styled-components/package.json"); // styled-components is a peer dependency. var markdownEditor = require("@accordproject/markdown-editor")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@accordproject/markdown-editor v0.92.2

Accord Project Web Components Markdown Editor

downloads npm version join slack

This repository contains a WYSIWYG editor for markdown that conforms to the CommonMark specification.

The editor is based on React, Slate, and the Accord Project markdown-transform project.


npm install @accordproject/markdown-editor @accordproject/markdown-slate slate slate-history slate-react semantic-ui-react


import React, { useState, useCallback } from 'react';
import ReactDOM from 'react-dom';
import { SlateTransformer } from '@accordproject/markdown-slate';
import { MarkdownEditor } from '@accordproject/markdown-editor';

const slateTransformer = new SlateTransformer();
const defaultMarkdown = `This is text. You can edit it.`;

const App = () => {
  const [slateValue, setSlateValue] = useState(() => {
    const slate = slateTransformer.fromMarkdown(defaultMarkdown);
    return slate.document.children;

  const onSlateValueChange = useCallback((slateChildren) => {
    localStorage.setItem('slate-editor-value', JSON.stringify(slateChildren));
    const slateValue = { document: { children: slateChildren } };
  }, []);

  return (<MarkdownEditor readOnly={false} value={slateValue} onChange={onSlateValueChange} />);

ReactDOM.render(<App />, document.getElementById('root'));

Develop inside Storybook

While Storybook is running, if you make a change in a package that you want to see reflected in the demo, in a new terminal:

cd packages/markdown-editor
npm run build

Storybook will reload with the applied changes.


Required Properties


  • value: An array which is the initial contents of the editor (markdown text)


  • onChange: A callback function called when contents of the editor change, receives the markdown text

Optional Properties


  • readOnly: A boolean to lock all text and remove the formatting toolbar
  • placeholder: Placeholder string for text when the editor is blank
  • activeButton: Optional object to change formatting button active state color
    • { background: '#FFF', symbol: '#000' }


  • onChange: A callback function called when contents of the editor change, receives the markdown text
  • augmentEditor: A higher order function to augment the methods on the Slate editor
  • customElements: A function for extending elements rendered by editor
  • isEditable: A function for determining if the current edit should be allowed
  • canBeFormatted: A function that determines if current formatting change should be allowed
  • canCopy: A function that determines if current selection copy should be allowed
  • canKeyDown: A function that determines if current key event should be allowed

Accord Project Logo

Accord Project is an open source, non-profit, initiative working to transform contract management and contract automation by digitizing contracts. Accord Project operates under the umbrella of the Linux Foundation. The technical charter for the Accord Project can be found here.

Learn More About Accord Project




The Accord Project technology is being developed as open source. All the software packages are being actively maintained on GitHub and we encourage organizations and individuals to contribute requirements, documentation, issues, new templates, and code.

Find out what’s coming on our blog.

Join the Accord Project Technology Working Group Slack channel to get involved!

For code contributions, read our CONTRIBUTING guide and information for DEVELOPERS.


Using Accord Project? Add a README badge to let everyone know: accord project

[![accord project](](


Accord Project source code files are made available under the Apache License, Version 2.0. Accord Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0).

Copyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See LF Projects Trademark Policy.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free