remark-notes-plugin 2.0.0 → 2.0.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 +86 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,10 +22,13 @@ npm install remark-notes-plugin
|
|
|
22
22
|
|
|
23
23
|
## 🚀 Usage
|
|
24
24
|
|
|
25
|
+
### Basic Usage
|
|
26
|
+
|
|
25
27
|
```typescript
|
|
26
28
|
import { unified } from 'unified'
|
|
27
29
|
import remarkParse from 'remark-parse'
|
|
28
|
-
import
|
|
30
|
+
import remarkRehype from 'remark-rehype'
|
|
31
|
+
import rehypeStringify from 'rehype-stringify'
|
|
29
32
|
import remarkNotes from 'remark-notes-plugin'
|
|
30
33
|
|
|
31
34
|
const markdown = `
|
|
@@ -48,12 +51,40 @@ const markdown = `
|
|
|
48
51
|
const file = await unified()
|
|
49
52
|
.use(remarkParse)
|
|
50
53
|
.use(remarkNotes)
|
|
51
|
-
.use(
|
|
54
|
+
.use(remarkRehype)
|
|
55
|
+
.use(rehypeStringify)
|
|
52
56
|
.process(markdown)
|
|
53
57
|
|
|
54
58
|
console.log(String(file))
|
|
55
59
|
```
|
|
56
60
|
|
|
61
|
+
### Configuration Options
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import remarkNotes from 'remark-notes-plugin'
|
|
65
|
+
|
|
66
|
+
// Default configuration (styles are auto-injected)
|
|
67
|
+
unified().use(remarkNotes)
|
|
68
|
+
|
|
69
|
+
// Custom class prefix
|
|
70
|
+
unified().use(remarkNotes, {
|
|
71
|
+
classPrefix: 'my-callout'
|
|
72
|
+
})
|
|
73
|
+
// Generates classes like: my-callout-remark-note, my-callout-remark-note-tip, etc.
|
|
74
|
+
|
|
75
|
+
// Disable automatic style injection (import CSS manually)
|
|
76
|
+
unified().use(remarkNotes, {
|
|
77
|
+
injectStyles: false
|
|
78
|
+
})
|
|
79
|
+
// Then import: import 'remark-notes-plugin/styles.css'
|
|
80
|
+
|
|
81
|
+
// Both options
|
|
82
|
+
unified().use(remarkNotes, {
|
|
83
|
+
classPrefix: 'custom',
|
|
84
|
+
injectStyles: false
|
|
85
|
+
})
|
|
86
|
+
```
|
|
87
|
+
|
|
57
88
|
## 📝 Note Types
|
|
58
89
|
|
|
59
90
|
The plugin supports five distinct types of notes, each with its own unique style:
|
|
@@ -90,9 +121,35 @@ The plugin supports five distinct types of notes, each with its own unique style
|
|
|
90
121
|
|
|
91
122
|
## 🎨 Styling
|
|
92
123
|
|
|
93
|
-
|
|
124
|
+
By default, styles are automatically injected into your document. You can customize this behavior:
|
|
125
|
+
|
|
126
|
+
### Automatic Style Injection (Default)
|
|
127
|
+
|
|
128
|
+
Styles are included automatically when you use the plugin with default settings:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
unified().use(remarkNotes) // Styles auto-injected
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Manual Style Import
|
|
135
|
+
|
|
136
|
+
If you prefer to manage styles yourself (e.g., for SSR or custom build tools), disable auto-injection:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
unified().use(remarkNotes, { injectStyles: false })
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Then manually import the CSS:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
import 'remark-notes-plugin/styles.css'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Customizing Styles
|
|
149
|
+
|
|
150
|
+
The plugin uses a modular class structure that makes it easy to customize the appearance:
|
|
94
151
|
|
|
95
|
-
|
|
152
|
+
#### Base Classes
|
|
96
153
|
|
|
97
154
|
- `.remark-note` - Base container for all note types
|
|
98
155
|
- `.remark-note-header` - Note header container
|
|
@@ -100,24 +157,39 @@ Default styles are loaded automatically when you use the plugin. You can also mo
|
|
|
100
157
|
- `.remark-note-title` - Note title styling
|
|
101
158
|
- `.remark-note-content` - Note content container
|
|
102
159
|
|
|
103
|
-
|
|
160
|
+
#### Type-Specific Classes
|
|
161
|
+
|
|
162
|
+
- `.remark-note-note` - Note type styling
|
|
163
|
+
- `.remark-note-tip` - Tip type styling
|
|
164
|
+
- `.remark-note-important` - Important type styling
|
|
165
|
+
- `.remark-note-quote` - Quote type styling
|
|
166
|
+
- `.remark-note-bonus` - Bonus type styling
|
|
167
|
+
|
|
168
|
+
#### Custom Class Prefix
|
|
169
|
+
|
|
170
|
+
You can add a custom prefix to all CSS classes:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
unified().use(remarkNotes, { classPrefix: 'my-callout' })
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
This generates classes like:
|
|
104
177
|
|
|
105
|
-
- `.remark-note
|
|
106
|
-
- `.remark-note
|
|
107
|
-
- `.remark-note
|
|
108
|
-
-
|
|
109
|
-
- `.remark-note.bonus` - Bonus type styling
|
|
178
|
+
- `.my-callout-remark-note`
|
|
179
|
+
- `.my-callout-remark-note-tip`
|
|
180
|
+
- `.my-callout-remark-note-header`
|
|
181
|
+
- etc.
|
|
110
182
|
|
|
111
|
-
|
|
183
|
+
#### Customization Example
|
|
112
184
|
|
|
113
185
|
```css
|
|
114
186
|
/* Example: Customize the Note type */
|
|
115
|
-
.remark-note
|
|
187
|
+
.remark-note-note {
|
|
116
188
|
background-color: #your-color;
|
|
117
189
|
border-color: #your-border-color;
|
|
118
190
|
}
|
|
119
191
|
|
|
120
|
-
.remark-note
|
|
192
|
+
.remark-note-note .remark-note-title {
|
|
121
193
|
color: #your-text-color;
|
|
122
194
|
}
|
|
123
195
|
```
|
|
@@ -152,4 +224,4 @@ Please ensure your pull request passes all tests and includes appropriate docume
|
|
|
152
224
|
|
|
153
225
|
---
|
|
154
226
|
|
|
155
|
-
⭐️ If you find this plugin useful, please consider giving it a star on GitHub! ⭐️
|
|
227
|
+
⭐️ If you find this plugin useful, please consider giving it a star on GitHub! ⭐️
|