remark-mind-elixir 0.3.3 → 0.4.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 +68 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -45,6 +45,71 @@ const file = await remark()
|
|
|
45
45
|
console.log(String(file))
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
## Usage with Astro
|
|
49
|
+
|
|
50
|
+
Install the plugin in your Astro project:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install remark-mind-elixir
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then add it to the `markdown.remarkPlugins` configuration in `astro.config.mjs`:
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
// @ts-check
|
|
60
|
+
import { defineConfig } from 'astro/config'
|
|
61
|
+
import remarkMindElixir from 'remark-mind-elixir'
|
|
62
|
+
|
|
63
|
+
export default defineConfig({
|
|
64
|
+
markdown: {
|
|
65
|
+
remarkPlugins: [remarkMindElixir()],
|
|
66
|
+
},
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
You can then use `elixir-mind` blocks directly in your Markdown or MDX pages:
|
|
71
|
+
|
|
72
|
+
````markdown
|
|
73
|
+
# JavaScript
|
|
74
|
+
|
|
75
|
+
```elixir-mind
|
|
76
|
+
root:
|
|
77
|
+
topic: JavaScript
|
|
78
|
+
children:
|
|
79
|
+
- topic: Browser
|
|
80
|
+
children:
|
|
81
|
+
- topic: DOM
|
|
82
|
+
- topic: Web APIs
|
|
83
|
+
- topic: Node.js
|
|
84
|
+
- topic: Deno
|
|
85
|
+
```
|
|
86
|
+
````
|
|
87
|
+
|
|
88
|
+
The plugin transforms the block during Astro's Markdown processing and injects the client-side Mind Elixir runtime automatically.
|
|
89
|
+
|
|
90
|
+
### Astro with CDN disabled
|
|
91
|
+
|
|
92
|
+
By default, `remark-mind-elixir` loads the client runtime from `esm.sh`.
|
|
93
|
+
|
|
94
|
+
You can disable this behavior:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
import { defineConfig } from 'astro/config'
|
|
98
|
+
import remarkMindElixir from 'remark-mind-elixir'
|
|
99
|
+
|
|
100
|
+
export default defineConfig({
|
|
101
|
+
markdown: {
|
|
102
|
+
remarkPlugins: [
|
|
103
|
+
remarkMindElixir({
|
|
104
|
+
useCdn: false,
|
|
105
|
+
}),
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
When `useCdn` is disabled, your application must provide the Mind Elixir client runtime itself.
|
|
112
|
+
|
|
48
113
|
## Markdown Syntax
|
|
49
114
|
|
|
50
115
|
Use an `elixir-mind` fenced code block:
|
|
@@ -73,6 +138,7 @@ Separate the configuration and data using `---`:
|
|
|
73
138
|
---
|
|
74
139
|
direction: right
|
|
75
140
|
---
|
|
141
|
+
|
|
76
142
|
root:
|
|
77
143
|
topic: JavaScript
|
|
78
144
|
children:
|
|
@@ -141,7 +207,7 @@ When disabled, the plugin does not inject the CDN runtime. Your application must
|
|
|
141
207
|
|
|
142
208
|
By default, the plugin injects the Mind Elixir runtime using `esm.sh`.
|
|
143
209
|
|
|
144
|
-
The generated
|
|
210
|
+
The generated HTML contains a container similar to:
|
|
145
211
|
|
|
146
212
|
```html
|
|
147
213
|
<div
|
|
@@ -200,4 +266,4 @@ It is built on top of ZikoJS utilities while remaining a remark plugin rather th
|
|
|
200
266
|
|
|
201
267
|
## License
|
|
202
268
|
|
|
203
|
-
MIT
|
|
269
|
+
MIT + Mind Elixir License
|
package/package.json
CHANGED