mark-deco-cli 0.1.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 +135 -0
- package/dist/cli.cjs +32515 -0
- package/dist/cli.cjs.map +1 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# mark-deco-cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for [mark-deco](https://npmjs.com/package/mark-deco) enhanced markdown processor with plugin support for oEmbed, Amazon cards, and more.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install globally
|
|
9
|
+
npm install -g mark-deco-cli
|
|
10
|
+
|
|
11
|
+
# Or run directly with npx
|
|
12
|
+
npx mark-deco-cli input.md
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Basic Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Process from stdin to stdout
|
|
21
|
+
echo "# Hello World" | mark-deco-cli
|
|
22
|
+
|
|
23
|
+
# Process a file
|
|
24
|
+
mark-deco-cli -i input.md
|
|
25
|
+
|
|
26
|
+
# Save output to file
|
|
27
|
+
mark-deco-cli -i input.md -o output.html
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Command Line Options
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Options:
|
|
34
|
+
-i, --input <file> Input markdown file (default: stdin)
|
|
35
|
+
-o, --output <file> Output HTML file (default: stdout)
|
|
36
|
+
-c, --config <file> Configuration file path
|
|
37
|
+
-p, --plugins <plugins...> Enable specific plugins (oembed, card, mermaid)
|
|
38
|
+
--no-plugins Disable all default plugins
|
|
39
|
+
--unique-id-prefix <prefix> Prefix for unique IDs (default: "section")
|
|
40
|
+
--hierarchical-heading-id Use hierarchical heading IDs (default: true)
|
|
41
|
+
--content-based-heading-id Use content-based heading IDs (default: false)
|
|
42
|
+
-h, --help Display help for command
|
|
43
|
+
-V, --version Display version number
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Examples
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Basic markdown processing
|
|
50
|
+
echo "# Hello World" | mark-deco-cli
|
|
51
|
+
|
|
52
|
+
# Process file with custom ID prefix
|
|
53
|
+
mark-deco-cli -i document.md --unique-id-prefix "doc"
|
|
54
|
+
|
|
55
|
+
# Disable all plugins
|
|
56
|
+
mark-deco-cli -i simple.md --no-plugins
|
|
57
|
+
|
|
58
|
+
# Enable specific plugins only
|
|
59
|
+
mark-deco-cli -i content.md -p oembed mermaid
|
|
60
|
+
|
|
61
|
+
# Use configuration file
|
|
62
|
+
mark-deco-cli -i content.md -c config.json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Configuration File
|
|
66
|
+
|
|
67
|
+
You can use a JSON configuration file to set default options:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"plugins": ["oembed", "card", "mermaid"],
|
|
72
|
+
"uniqueIdPrefix": "section",
|
|
73
|
+
"hierarchicalHeadingId": true,
|
|
74
|
+
"contentBasedHeadingId": false,
|
|
75
|
+
"oembed": {
|
|
76
|
+
"enabled": true,
|
|
77
|
+
"timeout": 5000
|
|
78
|
+
},
|
|
79
|
+
"card": {
|
|
80
|
+
"enabled": true,
|
|
81
|
+
"amazonAssociateId": "your-associate-id"
|
|
82
|
+
},
|
|
83
|
+
"mermaid": {
|
|
84
|
+
"enabled": true,
|
|
85
|
+
"theme": "default"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Supported Features
|
|
91
|
+
|
|
92
|
+
- **Frontmatter**: YAML frontmatter extraction and processing
|
|
93
|
+
- **GitHub Flavored Markdown**: Tables, task lists, strikethrough, and more
|
|
94
|
+
- **oEmbed**: Automatic embedding of YouTube, Twitter, and other oEmbed providers
|
|
95
|
+
- **Amazon Cards**: Rich cards for Amazon product links
|
|
96
|
+
- **Mermaid Diagrams**: Flowcharts, sequence diagrams, and more
|
|
97
|
+
- **Hierarchical Heading IDs**: Automatic generation of structured heading IDs
|
|
98
|
+
- **Responsive Images**: Automatic responsive image handling
|
|
99
|
+
|
|
100
|
+
## Plugin Support
|
|
101
|
+
|
|
102
|
+
### oEmbed Plugin
|
|
103
|
+
Automatically converts URLs from supported providers into rich embeds:
|
|
104
|
+
- YouTube videos
|
|
105
|
+
- Twitter posts
|
|
106
|
+
- Instagram posts
|
|
107
|
+
- And many more oEmbed providers
|
|
108
|
+
|
|
109
|
+
### Card Plugin
|
|
110
|
+
Creates rich cards for supported URLs:
|
|
111
|
+
- Amazon product links
|
|
112
|
+
- General webpage cards
|
|
113
|
+
|
|
114
|
+
### Mermaid Plugin
|
|
115
|
+
Renders Mermaid diagrams from code blocks:
|
|
116
|
+
```markdown
|
|
117
|
+
```mermaid
|
|
118
|
+
graph TD
|
|
119
|
+
A[Start] --> B[Process]
|
|
120
|
+
B --> C[End]
|
|
121
|
+
```
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
This CLI is part of the mark-deco monorepo. To contribute:
|
|
127
|
+
|
|
128
|
+
1. Clone the repository
|
|
129
|
+
2. Install dependencies: `npm install`
|
|
130
|
+
3. Build the project: `npm run build`
|
|
131
|
+
4. Run tests: `npm test`
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT License - see LICENSE file for details.
|