md-editor-lite
A lightweight React markdown editor focused on the
core editing experience.
Built with
TypeScript, designed for
library-friendly usage, and has
no runtime dependency other than React.
> Minimal. Predictable. Easy to integrate.
---
β¨ Features
- β‘
Minimal dependencies
β No heavy editor engines, no unnecessary packages
β Regex-based parsing for predictable behavior
- π
Controlled & Uncontrolled modes
β Works well with forms and external state management
- π§©
Customizable toolbar
β Enable only the features you need
- π¨
No CSS framework dependency
β No Tailwind, no opinionated styles
β Fully styleable with plain CSS
---
π§ Supported Markdown Syntax
- Bold:
bold
- Italic: _italic_
-
Underline:
underline
- Strikethrough: ~~strike~~
- Inline code:
code
- Blockquote: > quote
- Headings:
#,
##,
###
- Ordered / Unordered lists:
-
- item
-
1. item
- Images:
!alt
- Links:
text
> β οΈ This editor intentionally does not support fenced code blocks
> (code) to keep parsing logic lightweight and predictable.
---
π¦ Installation
``
bash
npm install md-editor-lite
`
---
$3
This library does not inject styles automatically.
`
ts
import "md-editor-lite/style.css";
`
---
π Basic Usage (Uncontrolled)
`
tsx
import { MarkdownEditor } from "md-editor-lite";
function App() {
return ;
}
`
---
π Controlled Usage
`
tsx
import { useState } from "react";
import { MarkdownEditor } from "md-editor-lite";
function App() {
const [value, setValue] = useState("");
return (
value={value}
onChange={setValue}
placeholder="Write your markdown here..."
/>
);
}
`
> Controlled mode is recommended when:
>
> - Integrating with forms
> - Saving content externally
> - Syncing editor state with other UI
---
π§© Props API
$3
| Prop | Type | Description |
| -------------- | ------------------------- | ---------------------------------- |
| value
| string
| Markdown content (controlled mode) |
| onChange
| (value: string) => void
| Called when content changes |
| defaultValue
| string
| Initial value (uncontrolled mode) |
| placeholder
| string
| Placeholder text for the editor |
| readOnly
| boolean
| Disable editing |
| toolbar
| ToolbarItem[]
| Customize visible toolbar items |
| className
| string
| Custom class for root container |
> If value
is provided, the editor automatically works in controlled mode.
---
π± Responsive Behavior
This library relies on the browser viewport for responsive layouts.
Make sure the following meta tag exists in your HTML document:
`
html
``
> β οΈ This library does
not inject meta tags automatically
> β Host applications should manage viewport settings themselves
---
π« Non-goals
md-editor-lite intentionally does NOT aim to be:
- A full CommonMark implementation
- A WYSIWYG editor
- A syntax-highlighting code editor
This library focuses on
simple text input with markdown preview,
not complex document authoring.
---
π°π· νκ΅μ΄ μ€λͺ
μκ°
md-editor-liteλ
βνμν κΈ°λ₯λ§ μ 곡νκ³ , λλ¨Έμ§λ κ°λ°μμκ² λ§‘κΈ΄λ€βλ μ² νμΌλ‘ λ§λ
κ²½λ React λ§ν¬λ€μ΄ μλν° λΌμ΄λΈλ¬λ¦¬μ
λλ€.
λν μλν°λ€μ΄ νν κ°μ§λ
- κ³Όλν λ²λ€ μ¬μ΄μ¦
- 볡μ‘ν μ€μ
- κ°μ λλ μ€νμΌ κ΅¬μ‘°
μ΄λ° λ¬Έμ λ₯Ό νΌνκ³ ,
νΌ / CMS / κ΄λ¦¬μ νμ΄μ§ / μ¬μ΄λ νλ‘μ νΈ μ΄λμλ
λΆλ΄ μμ΄ μ¬μ©ν μ μλλ‘ μ€κ³λμμ΅λλ€.
---
μ£Όμ νΉμ§
$3
- λ°νμ μμ‘΄μ±μ Reactλ§ νμ
- μΈλΆ μλν° μμ§ μμ΄ λμ
- λΌμ΄λΈλ¬λ¦¬Β·λμμΈ μμ€ν
λ΄λΆμμλ μμ νκ² μ¬μ© κ°λ₯
$3
- λ¨μ textareaμ²λΌ λΉ λ₯΄κ² μ¬μ© κ°λ₯
- μνλ₯Ό μΈλΆμμ μμ ν μ μ΄νλ ꡬ쑰λ μ§μ
- React Hook Form λ±κ³Ό νΈν κ°λ₯
$3
- Tailwind / CSS Modules / styled-components λ±
μ΄λ€ μ€νμΌλ§ λ°©μκ³Όλ μΆ©λνμ§ μμ
- κΈ°λ³Έ μ€νμΌμ μ΅μνλ§ μ 곡
$3
- μ μ CSS μ£Όμ
μμ
- meta tag μλ μ½μ
μμ
- νΈμ€νΈ μ ν리μΌμ΄μ
μ νκ²½μ μΉ¨λ²νμ§ μμ
---
μ΄λ° κ²½μ°μ μ μ΄μΈλ €μ
- βμλν° νλ λλ¬Έμ λΌμ΄λΈλ¬λ¦¬κ° 무거μμ§λ κ² μ«μ λβ
- κ΄λ¦¬μ νμ΄μ§μ μ¬νν λ§ν¬λ€μ΄ μ
λ ₯ UIκ° νμν λ
- λμμΈ μμ€ν
μμ μμ°μ€λ½κ² λ
Ήμλλ μλν°κ° νμν λ
---
> md-editor-liteλ CommonMark μ 체λ₯Ό ꡬννλ κ²μ λͺ©νλ‘ νμ§ μμ΅λλ€.
> λ¬Έλ² μΆ©λκ³Ό μμΈ μ²λ¦¬κ° λ§μ κΈ°λ₯(code block, table λ±)μ μλμ μΌλ‘ μ μΈνμ΅λλ€.