remove-markdown 0.6.4 → 0.7.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -2
- package/index.d.mts +13 -0
- package/index.mjs +3 -0
- package/package.json +47 -6
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://github.com/zuchka/remove-markdown/actions/workflows/default.yaml)
|
|
4
4
|
|
|
5
5
|
## What is it?
|
|
6
|
-
**remove-markdown** is a
|
|
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?
|
|
@@ -11,17 +11,40 @@ The typical use case is to display an excerpt from some Markdown text, without a
|
|
|
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
|
const removeMd = require('remove-markdown');
|
|
21
24
|
const markdown = '# This is a heading\n\nThis is a paragraph with [a link](http://www.disney.com/) in it.';
|
|
22
25
|
const plainText = 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
|
+
import removeMd from 'remove-markdown';
|
|
32
|
+
|
|
33
|
+
const markdown = '# This is a heading\n\nThis is a paragraph with [a link](http://www.disney.com/) in it.';
|
|
34
|
+
const plainText = removeMd(markdown);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Deno
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import removeMd from 'npm:remove-markdown@^0.7.0';
|
|
41
|
+
|
|
42
|
+
const markdown = '# This is a heading\n\nThis is a paragraph with [a link](http://www.disney.com/) in it.';
|
|
43
|
+
const plainText = 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:
|
|
26
49
|
|
|
27
50
|
```js
|
package/index.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare function removeMd(md: string, options?: {
|
|
2
|
+
stripListLeaders?: boolean;
|
|
3
|
+
listUnicodeChar?: string;
|
|
4
|
+
gfm?: boolean;
|
|
5
|
+
useImgAltText?: boolean;
|
|
6
|
+
abbr?: boolean;
|
|
7
|
+
replaceLinksWithURL?: boolean;
|
|
8
|
+
separateLinksAndTexts?: string;
|
|
9
|
+
htmlTagsToSkip?: string[];
|
|
10
|
+
throwError?: boolean;
|
|
11
|
+
}): string;
|
|
12
|
+
|
|
13
|
+
export default removeMd;
|
package/index.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,20 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remove-markdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-rc.0",
|
|
4
4
|
"description": "Remove Markdown formatting from text",
|
|
5
|
-
"
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./index.d.mts",
|
|
12
|
+
"default": "./index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
18
|
+
"default": "./index.js"
|
|
19
|
+
},
|
|
20
|
+
"./index": "./index.js",
|
|
21
|
+
"./index.js": "./index.js",
|
|
22
|
+
"./index.d.mts": "./index.d.mts",
|
|
23
|
+
"./index.d.ts": "./index.d.ts",
|
|
24
|
+
"./LICENSE": "./LICENSE",
|
|
25
|
+
"./README.md": "./README.md",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
6
28
|
"files": [
|
|
7
29
|
"index.js",
|
|
30
|
+
"index.mjs",
|
|
8
31
|
"index.d.ts",
|
|
32
|
+
"index.d.mts",
|
|
9
33
|
"README.md",
|
|
10
34
|
"LICENSE"
|
|
11
35
|
],
|
|
12
36
|
"scripts": {
|
|
13
|
-
"test": "
|
|
37
|
+
"test": "mocha -R spec test/remove-markdown.js",
|
|
38
|
+
"test:modules": "node --test test/modules.test.mjs",
|
|
39
|
+
"test:package": "node --test test/package.test.mjs",
|
|
40
|
+
"test:types": "node --test test/types.test.mjs",
|
|
41
|
+
"test:differential": "node --test test/differential.test.mjs",
|
|
42
|
+
"test:bundlers": "node --test test/bundlers.test.mjs",
|
|
43
|
+
"test:deno": "deno test test/deno.test.mjs",
|
|
44
|
+
"test:deno:package": "node --test test/deno-package.test.mjs",
|
|
45
|
+
"prepublishOnly": "npm test && npm run test:modules && npm run test:package && npm run test:types"
|
|
14
46
|
},
|
|
15
47
|
"repository": {
|
|
16
48
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/zuchka/remove-markdown.git"
|
|
49
|
+
"url": "git+https://github.com/zuchka/remove-markdown.git"
|
|
18
50
|
},
|
|
19
51
|
"keywords": [
|
|
20
52
|
"markdown"
|
|
@@ -26,8 +58,17 @@
|
|
|
26
58
|
},
|
|
27
59
|
"homepage": "https://github.com/zuchka/remove-markdown",
|
|
28
60
|
"devDependencies": {
|
|
61
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
62
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
63
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
29
64
|
"chai": "^4.0.2",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
65
|
+
"esbuild": "^0.28.2",
|
|
66
|
+
"mocha": "11.3.0",
|
|
67
|
+
"rollup": "^4.62.5",
|
|
68
|
+
"should": "^5.0.0",
|
|
69
|
+
"typescript": "^7.0.2"
|
|
70
|
+
},
|
|
71
|
+
"overrides": {
|
|
72
|
+
"serialize-javascript": "^7.0.5"
|
|
32
73
|
}
|
|
33
74
|
}
|