@dice-roller/vuepress-plugin-dice-roller 0.1.9

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/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 - 2021 GreenImp Limited
4
+ Copyright (c) 2021 - present GreenImp Media Limited
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ <p align="center">
2
+ <img src="https://greenimp.github.io/rpg-dice-roller/hero.svg" alt="RPG Dice Roller" style="max-width: 100%;" width="180"/>
3
+ </p>
4
+
5
+ # RPG Dice Roller Vuepress Plugin
6
+
7
+ Plugin for [VuePress](https://vuepress.vuejs.org/) that allows rolling dice.
8
+
9
+ It is built upon this [RPG dice roller](https://github.com/GreenImp/rpg-dice-roller), and is used in the [documentation](https://greenimp.github.io/rpg-dice-roller).
10
+
11
+
12
+ ## Install
13
+
14
+ Install the plugin:
15
+
16
+ ```bash
17
+ npm install -D @dice-roller/vuepress-plugin
18
+ # Or
19
+ yarn add -D @dice-roller/vuepress-plugin
20
+ ```
21
+
22
+ Then add the plugin to your Vuepress config file:
23
+
24
+ ```javascript
25
+ module.exports = {
26
+ ...
27
+ plugins: [
28
+ ...
29
+ 'dice-roller',
30
+ ],
31
+ };
32
+ ```
33
+
34
+
35
+ ## Usage
36
+
37
+ You can add a dice roller anywhere by using the following markdown syntax, where `{notation}` is the optional notation to pre-fill the input with:
38
+
39
+ ```
40
+ ::: roll {notation} :::
41
+ ```
42
+
43
+ For example:
44
+
45
+ ```
46
+ ::: roll 4d6 ::
47
+ ```
48
+
49
+ ```
50
+ ::: roll (2*6)d10 / (4 - d20) :::
51
+ ```
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@dice-roller/vuepress-plugin-dice-roller",
3
+ "version": "0.1.9",
4
+ "description": "Plugin for VuePress that allows rolling dice",
5
+ "main": "src/index.js",
6
+ "scripts": {
7
+ "serve": "vue-cli-service serve",
8
+ "build": "vue-cli-service build",
9
+ "lint": "vue-cli-service lint",
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/dice-roller/vuepress-plugin.git"
15
+ },
16
+ "keywords": [
17
+ "vuepress",
18
+ "dice",
19
+ "roll"
20
+ ],
21
+ "author": "GreenImp Media <info@greenimp.co.uk> (http://greenimp.co.uk)",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/dice-roller/vuepress-plugin/issues"
25
+ },
26
+ "homepage": "https://github.com/dice-roller/vuepress-plugin",
27
+ "dependencies": {
28
+ "@dice-roller/vue": "^0.1.8",
29
+ "core-js": "^3.6.5",
30
+ "markdown-it-container": "^2.0.0",
31
+ "vue": "^2.6.12"
32
+ },
33
+ "devDependencies": {
34
+ "@vue/cli-plugin-babel": "~4.3.0",
35
+ "@vue/cli-plugin-eslint": "~4.3.0",
36
+ "@vue/cli-service": "~4.3.0",
37
+ "@vue/eslint-config-airbnb": "^5.1.0",
38
+ "babel-eslint": "^10.1.0",
39
+ "eslint": "^6.7.2",
40
+ "eslint-plugin-import": "^2.22.0",
41
+ "eslint-plugin-vue": "^6.2.2",
42
+ "vue-template-compiler": "^2.6.12"
43
+ }
44
+ }
@@ -0,0 +1,5 @@
1
+ import DiceRoller from '@dice-roller/vue';
2
+
3
+ export default ({ Vue }) => {
4
+ Vue.component('DiceRoller', DiceRoller);
5
+ };
package/src/index.js ADDED
@@ -0,0 +1,26 @@
1
+ const markdownItContainer = require('markdown-it-container');
2
+ const path = require('path');
3
+
4
+ function render(tokens, idx) {
5
+ const { nesting, info } = tokens[idx];
6
+
7
+ if (nesting === 1) {
8
+ // opening tag
9
+ const [, notation] = info.trim().match(/roll\s+(.*?(?=\s*:::))/);
10
+
11
+ return `<DiceRoller notation="${notation}"/>`;
12
+ }
13
+
14
+ // closing tag
15
+ return '';
16
+ }
17
+
18
+ module.exports = (options = {}) => ({
19
+ name: 'vuepress-plugin-dice-roller',
20
+ enhanceAppFiles: [
21
+ path.resolve(__dirname, 'enhanceAppFile.js'),
22
+ ],
23
+ extendMarkdown: (md) => {
24
+ md.use(markdownItContainer, 'roll', { render });
25
+ },
26
+ });