catmdx 0.1.0 → 0.1.1
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 +6 -3
- package/dist/cli.js +2 -2
- package/package.json +13 -10
package/README.md
CHANGED
|
@@ -7,6 +7,9 @@ Read markdown efficiently.
|
|
|
7
7
|
```bash
|
|
8
8
|
# read metadata, TOC and the '#Usage' section from target markdown
|
|
9
9
|
npx catmdx README.md --metadata --toc --section 'Usage'
|
|
10
|
+
|
|
11
|
+
# or - read from online files
|
|
12
|
+
curl https://raw.githubusercontent.com/gzzhanghao/catmdx/refs/heads/main/README.md | npx catmdx --toc --stdin
|
|
10
13
|
```
|
|
11
14
|
|
|
12
15
|
## Options
|
|
@@ -20,7 +23,7 @@ Arguments:
|
|
|
20
23
|
Options:
|
|
21
24
|
-c, --content <content> Markdown content provided as a string
|
|
22
25
|
-i, --stdin Read markdown content from stdin
|
|
23
|
-
-m, --metadata Print metadata
|
|
24
|
-
-t, --toc Print table of contents
|
|
25
|
-
-s, --section <section> Print specific section
|
|
26
|
+
-m, --metadata Print metadata
|
|
27
|
+
-t, --toc Print table of contents
|
|
28
|
+
-s, --section <section> Print specific section (e.g. "Introduction" or "#2")
|
|
26
29
|
```
|
package/dist/cli.js
CHANGED
|
@@ -14,8 +14,8 @@ async function getContent(options) {
|
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/cli.ts
|
|
17
|
-
program.description("Parse and display specific contents of a markdown").argument("[path]", "Path to the markdown file, optional with --content or --stdin flag").option("-c, --content <content>", "Markdown content provided as a string").option("-i, --stdin", "Read markdown content from stdin").option("-m, --metadata", "Print metadata
|
|
18
|
-
if (!
|
|
17
|
+
program.description("Parse and display specific contents of a markdown").argument("[path]", "Path to the markdown file, optional with --content or --stdin flag").option("-c, --content <content>", "Markdown content provided as a string").option("-i, --stdin", "Read markdown content from stdin").option("-m, --metadata", "Print metadata").option("-t, --toc", "Print table of contents").option("-s, --section <section>", "Print specific section (e.g. \"Introduction\" or \"#2\")").action(async (file, options) => {
|
|
18
|
+
if (!file && !options.content && !options.stdin) program.addHelpText("after", "\nError: Please provide a file path / markdown content / or the stdin flag").help();
|
|
19
19
|
const content = await getContent({
|
|
20
20
|
...options,
|
|
21
21
|
file
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "catmdx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/gzzhanghao/catmdx"
|
|
6
|
+
"url": "git+https://github.com/gzzhanghao/catmdx.git"
|
|
7
7
|
},
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"type": "module",
|
|
@@ -15,11 +15,19 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"main": "./dist/index.js",
|
|
18
|
-
"bin":
|
|
18
|
+
"bin": {
|
|
19
|
+
"catmdx": "bin/cli.js"
|
|
20
|
+
},
|
|
19
21
|
"files": [
|
|
20
22
|
"bin",
|
|
21
23
|
"dist"
|
|
22
24
|
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "rolldown -c rolldown.config.js",
|
|
27
|
+
"dev": "rolldown -wc rolldown.config.js",
|
|
28
|
+
"test": "vitest run --coverage",
|
|
29
|
+
"test:dev": "vitest --coverage"
|
|
30
|
+
},
|
|
23
31
|
"dependencies": {
|
|
24
32
|
"commander": "^14.0.3",
|
|
25
33
|
"marked": "^17.0.3"
|
|
@@ -39,10 +47,5 @@
|
|
|
39
47
|
"typescript-eslint": "^8.56.1",
|
|
40
48
|
"vitest": "^4.0.18"
|
|
41
49
|
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"dev": "rolldown -wc rolldown.config.js",
|
|
45
|
-
"test": "vitest run --coverage",
|
|
46
|
-
"test:dev": "vitest --coverage"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
50
|
+
"packageManager": "pnpm@10.28.1"
|
|
51
|
+
}
|