@dice-roller/vuepress-plugin-dice-roller 1.2.4 → 1.3.0-alpha.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/package.json +2 -1
- package/src/node/diceRollerPlugin.js +20 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dice-roller/vuepress-plugin-dice-roller",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-alpha.0",
|
|
4
4
|
"description": "Plugin for VuePress that allows rolling dice",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"vuepress": "2.0.0 || >=2.0.0-beta.51 <2.0.0-beta.50-pre"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@dice-roller/markdown-it-dice-roller": "^0.0.1-alpha.1",
|
|
38
39
|
"@dice-roller/vue": "^1.2.0",
|
|
39
40
|
"markdown-it-container": "^3.0.0"
|
|
40
41
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getDirname, path } from '@vuepress/utils';
|
|
2
|
-
import
|
|
2
|
+
import { Roll, Roller } from '@dice-roller/markdown-it-dice-roller';
|
|
3
3
|
|
|
4
4
|
const __dirname = getDirname(import.meta.url);
|
|
5
5
|
|
|
6
|
-
const render = (tokens, idx) => {
|
|
6
|
+
/* const render = (tokens, idx) => {
|
|
7
7
|
const { nesting, info } = tokens[idx];
|
|
8
8
|
|
|
9
9
|
if (nesting === 1) {
|
|
@@ -15,12 +15,28 @@ const render = (tokens, idx) => {
|
|
|
15
15
|
|
|
16
16
|
// closing tag
|
|
17
17
|
return '';
|
|
18
|
-
}
|
|
18
|
+
};*/
|
|
19
|
+
/* const render = (tokens, idx) => {
|
|
20
|
+
const { nesting, info } = tokens[idx];
|
|
21
|
+
|
|
22
|
+
if (nesting === 1) {
|
|
23
|
+
// opening tag
|
|
24
|
+
const [, notation] = info.trim().match(/^rolls?\s+(.*?)(:::)?$/s) ?? [];
|
|
25
|
+
//const [, ...matches] = info.trim().match(/^rolls?\s+(.*?)(:::)?$/s) || [];
|
|
26
|
+
|
|
27
|
+
return `<DiceRoller notation="${notation ?? ''}"/>`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// closing tag
|
|
31
|
+
return '';
|
|
32
|
+
}; */
|
|
19
33
|
|
|
20
34
|
export const diceRollerPlugin = () => ({
|
|
21
35
|
name: '@dice-roller/vuepress-plugin-dice-roller',
|
|
22
36
|
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
|
23
37
|
extendsMarkdown: (md) => {
|
|
24
|
-
md.use(markdownItContainer, 'roll', { render });
|
|
38
|
+
//md.use(markdownItContainer, 'roll', { render });
|
|
39
|
+
md.use(Roll, 'roll');
|
|
40
|
+
md.use(Roller, 'roller');
|
|
25
41
|
},
|
|
26
42
|
});
|