Copy Rich Text As Markdown In React

An easy React hook that enables you to copy the selected rich text as markdown. Based on the turndown JavaScript library.

How to use it:

1. Install and import the react hook.

# Yarn
$ yarn add @cnakazawa/copy-as-markdown

$ npm i @cnakazawa/copy-as-markdown
import useCopyAsMarkdown from '@cnakazawa/copy-as-markdown';

2. Basic usage.

export default function MyComponent() {
  const setRef = useCopyAsMarkdown();
  return (
    <div ref={setRef}>
      <h1>Select To Copy</h1>

3. Customize the list marker and strong delimiter.

const setRef = useCopyAsMarkdown({
      bulletListMarker: '-',
      strongDelimiter: '__',


Copy Rich Text As Markdown In React

Download Details:

Author: cpojer

Live Demo: View The Demo

Download Link: Download The Source Code

Official Website:

License: MIT

Add Comment