void 0.10.6 → 0.10.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "void",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/voidzero-dev/void.git",
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
"valibot": ">=1.0.0-beta.7",
|
|
354
354
|
"vite": "^8.0.0",
|
|
355
355
|
"zod": "^3.25.0 || ^4.0.0",
|
|
356
|
-
"@void/md": "0.10.
|
|
356
|
+
"@void/md": "0.10.7"
|
|
357
357
|
},
|
|
358
358
|
"peerDependenciesMeta": {
|
|
359
359
|
"@void/md": {
|
|
@@ -47,7 +47,8 @@ nums = [x for x in range(10)]
|
|
|
47
47
|
|
|
48
48
|
Output:
|
|
49
49
|
```html
|
|
50
|
-
<pre data="asdf"
|
|
50
|
+
<pre><code data="asdf" class="language-python">
|
|
51
|
+
nums = [x for x in range(10)]
|
|
51
52
|
</code></pre>
|
|
52
53
|
```
|
|
53
54
|
|
|
@@ -292,53 +293,35 @@ Output:
|
|
|
292
293
|
If you need finer control, [decorate](https://github.com/rstacruz/markdown-it-decorate) might help you.
|
|
293
294
|
|
|
294
295
|
## Custom rendering
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
If you prefer markdown-it's default behavior (attributes on `<code>`), opt out:
|
|
296
|
+
If you would like some other output, you can override renderers:
|
|
298
297
|
|
|
299
298
|
```js
|
|
300
299
|
const md = require('markdown-it')();
|
|
301
300
|
const markdownItAttrs = require('markdown-it-attrs');
|
|
302
301
|
|
|
303
|
-
md.use(markdownItAttrs
|
|
304
|
-
fenceAttrsOnPre: false
|
|
305
|
-
});
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
If you need fully custom output, define your own `fence` renderer. The plugin
|
|
309
|
-
will not override an existing custom `fence` renderer.
|
|
310
|
-
|
|
311
|
-
```js
|
|
312
|
-
const md = require('markdown-it')();
|
|
313
|
-
const markdownItAttrs = require('markdown-it-attrs');
|
|
302
|
+
md.use(markdownItAttrs);
|
|
314
303
|
|
|
304
|
+
// custom renderer for fences
|
|
315
305
|
md.renderer.rules.fence = function (tokens, idx, options, env, slf) {
|
|
316
306
|
const token = tokens[idx];
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
return '<pre' + slf.renderAttrs(token) + '><code' + langClass + '>'
|
|
323
|
-
+ content
|
|
324
|
-
+ '</code></pre>\n';
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
md.use(markdownItAttrs);
|
|
307
|
+
return '<pre' + slf.renderAttrs(token) + '>'
|
|
308
|
+
+ '<code>' + token.content + '</code>'
|
|
309
|
+
+ '</pre>';
|
|
310
|
+
}
|
|
328
311
|
|
|
329
|
-
|
|
312
|
+
let src = [
|
|
330
313
|
'',
|
|
331
314
|
'```js {.abcd}',
|
|
332
315
|
'var a = 1;',
|
|
333
316
|
'```'
|
|
334
|
-
].join('\n')
|
|
317
|
+
].join('\n')
|
|
335
318
|
|
|
336
319
|
console.log(md.render(src));
|
|
337
320
|
```
|
|
338
321
|
|
|
339
322
|
Output:
|
|
340
323
|
```html
|
|
341
|
-
<pre class="abcd"><code
|
|
324
|
+
<pre class="abcd"><code>var a = 1;
|
|
342
325
|
</code></pre>
|
|
343
326
|
```
|
|
344
327
|
|