You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**remove-markdown** is a node.js module that will remove (strip) Markdown formatting from text.
6
+
**remove-markdown** is a JavaScript module that removes (strips) Markdown formatting from text. It supports CommonJS and ES modules in Node.js, plus Deno through npm compatibility.
7
7
*Markdown formatting* means pretty much anything that doesn’t look like regular text, like square brackets, asterisks etc.
8
8
9
9
## When do I need it?
10
10
The typical use case is to display an excerpt from some Markdown text, without any of the actual Markdown syntax - for example in a list of posts.
11
11
12
12
## Installation
13
13
14
-
```
14
+
```sh
15
15
npm install remove-markdown
16
16
```
17
17
18
18
## Usage
19
+
20
+
### CommonJS
21
+
19
22
```js
20
23
constremoveMd=require('remove-markdown');
21
24
constmarkdown='# This is a heading\n\nThis is a paragraph with [a link](http://www.disney.com/) in it.';
22
25
constplainText=removeMd(markdown); // plainText is now 'This is a heading\n\nThis is a paragraph with a link in it.'
23
26
```
24
27
28
+
### Node.js ES modules
29
+
30
+
```js
31
+
importremoveMdfrom'remove-markdown';
32
+
33
+
constmarkdown='# This is a heading\n\nThis is a paragraph with [a link](http://www.disney.com/) in it.';
34
+
constplainText=removeMd(markdown);
35
+
```
36
+
37
+
### Deno
38
+
39
+
```js
40
+
importremoveMdfrom'npm:remove-markdown@^0.7.0';
41
+
42
+
constmarkdown='# This is a heading\n\nThis is a paragraph with [a link](http://www.disney.com/) in it.';
43
+
constplainText=removeMd(markdown);
44
+
```
45
+
46
+
Deno support is provided through the npm package; there is no separate JSR package. The package exposes one callable default export in every runtime. Named exports and direct imports from raw GitHub URLs are not supported.
47
+
25
48
You can also supply an options object to the function. Currently, the following options are supported:
0 commit comments