React components for Meowdown, a hybrid (live-preview) Markdown editor.
Install the package and its peer dependencies:
npm install @meowdown/react @meowdown/core react react-domImport both stylesheets and render the editor:
import '@meowdown/core/style.css'
import '@meowdown/react/style.css'
import { MeowdownEditor } from '@meowdown/react'
export function App() {
return <MeowdownEditor initialMarkdown="# Hello" />
}import '@meowdown/core/style.css'
import '@meowdown/react/style.css'
import { MeowdownEditor, type EditorHandle } from '@meowdown/react'
import { useRef, useCallback } from 'react'
export function App() {
const ref = useRef<EditorHandle>(null)
const handleDocChange = useCallback(() => {
console.log(ref.current?.getMarkdown())
}, [])
return (
<MeowdownEditor
handleRef={ref}
mode="focus"
initialMarkdown="# Hello"
onDocChange={handleDocChange}
/>
)
}See the full API reference here.
Import both stylesheets: @meowdown/core/style.css (the editor theme and variables) and @meowdown/react/style.css (the component layout). The core theme is documented in @meowdown/core.
MIT