@edc4it/reveal.js-railroad 1.0.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/LICENSE +21 -0
- package/README.md +96 -0
- package/dist/impl/main.d.ts +3 -0
- package/dist/impl/styles.d.ts +3 -0
- package/dist/options.d.ts +13 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/railroad-D1NexFHb.mjs +1203 -0
- package/dist/railroad.es.js +110 -0
- package/dist/railroad.umd.js +57 -0
- package/dist/util/utility-types.d.ts +3 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 EDC4IT B.V.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Reveal.js Railroad-diagram
|
|
2
|
+
|
|
3
|
+
[](#)
|
|
4
|
+
|
|
5
|
+
A [reveal.js](https://revealjs.com/) plugin that adds support for Railroad-diagrams.
|
|
6
|
+
It is a thin wrapper around the amazing [Railroad-diagram Generator](https://github.com/tabatkins/railroad-diagrams) project.
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<script type="application/railroad">
|
|
14
|
+
Diagram(
|
|
15
|
+
'function',
|
|
16
|
+
NonTerminal('identifier'),
|
|
17
|
+
'(', ZeroOrMore('param', ','), ')',
|
|
18
|
+
'{', ZeroOrMore(NonTerminal('statement')), '}');
|
|
19
|
+
</script>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Important** notes:
|
|
23
|
+
|
|
24
|
+
- We chose the "holder" to be `<script type="application/railroad">`
|
|
25
|
+
- The containment script is **executed** using [`eval`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval). This could be an enormous security risk if you don't know the authors of your slides.
|
|
26
|
+
|
|
27
|
+
## Quickstart
|
|
28
|
+
|
|
29
|
+
### Installation
|
|
30
|
+
|
|
31
|
+
This plugin is published to, and can be installed from, npm.
|
|
32
|
+
|
|
33
|
+
```console
|
|
34
|
+
npm install add @edc4it/reveal.js-railroad
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or using yarn
|
|
38
|
+
|
|
39
|
+
```console
|
|
40
|
+
yarn add @edc4it/reveal.js-railroad
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Initialise (as npm library)
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import Reveal from 'reveal.js';
|
|
47
|
+
import ClipCode from '@edc4it/reveal.js-clipcode';
|
|
48
|
+
|
|
49
|
+
Reveal.initialize({
|
|
50
|
+
railroad: {
|
|
51
|
+
// Default values
|
|
52
|
+
bg: 'unset',
|
|
53
|
+
pathStroke: '#82e4ff',
|
|
54
|
+
rectFill: '#00a6ff',
|
|
55
|
+
rectStroke: 'white',
|
|
56
|
+
textFill: 'white',
|
|
57
|
+
},
|
|
58
|
+
plugins: [RailRoad],
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Add a diagram
|
|
63
|
+
|
|
64
|
+
For the full syntax of "components" see [Railroad-Diagram components](https://github.com/tabatkins/railroad-diagrams/blob/gh-pages/README-js.md#components)
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<script type="application/railroad">
|
|
68
|
+
Diagram(
|
|
69
|
+
'function',
|
|
70
|
+
NonTerminal('identifier'),
|
|
71
|
+
'(', ZeroOrMore('param', ','), ')',
|
|
72
|
+
'{', ZeroOrMore(NonTerminal('statement')), '}');
|
|
73
|
+
</script>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Global options
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
Reveal.initialize({
|
|
80
|
+
railroad: {
|
|
81
|
+
// Default values
|
|
82
|
+
bg: 'unset',
|
|
83
|
+
pathStroke: '#82e4ff',
|
|
84
|
+
rectFill: '#00a6ff',
|
|
85
|
+
rectStroke: 'white',
|
|
86
|
+
textFill: 'white',
|
|
87
|
+
},
|
|
88
|
+
plugins: [RailRoad],
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- `bg`: the background of the diagram
|
|
93
|
+
- `pathStroke`: the color used for the "path" of the railroad diagram,
|
|
94
|
+
- `rectFill`: 'the fill/background color of the components
|
|
95
|
+
- `rectStroke`: 'the stroke color of the components,
|
|
96
|
+
- `textFill`: color of the text inside the components,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Options as RevealOptions } from 'reveal.js';
|
|
2
|
+
|
|
3
|
+
export type Options = {
|
|
4
|
+
bg: string;
|
|
5
|
+
textFill: string;
|
|
6
|
+
pathStroke: string;
|
|
7
|
+
rectFill: string;
|
|
8
|
+
rectStroke: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const defaultOptions: Options;
|
|
11
|
+
export type AugmentedRevealOptions = RevealOptions & {
|
|
12
|
+
railroad?: Options;
|
|
13
|
+
};
|