How can I help you?
TurndownService
12 Sep 20252 minutes to read
Methods
addRule
Adds a rule
| Parameter | Type | Description |
|---|---|---|
| key | string |
The unique key of the rule |
| rule | Rule |
The rule |
Returns TurndownService
escape
Escapes Markdown syntax
| Parameter | Type | Description |
|---|---|---|
| string | string |
The string to escape |
Returns string
keep
Keep a node (as HTML) that matches the filter
| Parameter | Type | Description |
|---|---|---|
| filter |
string | string[] | Object
|
The unique key of the rule |
Returns TurndownService
remove
Remove a node that matches the filter
| Parameter | Type | Description |
|---|---|---|
| filter |
string | string[] | Object
|
The unique key of the rule |
Returns TurndownService
turndown
The entry point for converting a string or DOM node to Markdown
| Parameter | Type | Description |
|---|---|---|
| input |
string | HTMLElement
|
The string or DOM node to convert |
Returns string
use
Add one or more plugins
| Parameter | Type | Description |
|---|---|---|
| plugin |
Object | Object[]
|
The plugin or array of plugins to add |
Returns TurndownService