1.0.26 • Published 2 years ago

novel-md v1.0.26

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Novel.sh : bi-directional markdown import & export


Convert your Notion-style block editor to Markdown in real-time, and also read the Markdown to accurately restore the editor's state.

Useful for: 1. Future-proofing written content 2. Having a flexible intuitive editor which is able to write to a file format that is universally known

Still needs work:

  • Nested structures
  • Image drag and drop from web

Feel free to contribute and use!!

Demo

!(https://amirrezapanahi.github.io/novel-md-demo/)https://amirrezapanahi.github.io/novel-md-demo/

Install

$ npm install novel-md 

Usage

using the !(novel)https://github.com/steven-tey/novel editor Editor we can get the editor state from the onUpdate callback. From there we can perform the conversion to markdown

  <Editor onUpdate={(editor: Editor ) => {
      const html: string = editor.getHTML()
      const md: string = htmlToMarkdown(html)
  }} />

Here is how to set the default state of the editor to the imported markdown. It is first converted from markdown into html, and then to the editor state

  const md = "# Hello world!"
  const html = markdownToHtml(md)
  const editorState = htmlToEditorState(html)
  ...
  <Editor defaultValue={editorState} />
  ...
1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago