@farberg/reveal-template 1.0.49 → 1.0.50
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 +50 -6
- package/package.json +3 -3
- package/plugins/reveal-plugin-dir-tree.js +18 -0
- package/plugins/reveal-plugin-html-example.js +18 -0
- package/plugins/reveal-plugin-prefix-with-base-url.js +11 -0
- package/plugins/reveal-plugin-show-attribution.js +9 -0
- package/plugins/reveal-plugin-show-code-snippets.js +18 -0
- package/plugins/reveal-plugin-show-qr-code.js +18 -0
- package/plugins/reveal-plugin-show-title.js +20 -0
- package/plugins/reveal-plugin-show-toc.js +15 -0
- package/docs/cdn.html +0 -28
package/README.md
CHANGED
|
@@ -1,21 +1,65 @@
|
|
|
1
1
|
# reveal-template
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is a helper package to simplify the generation of reveal.js presentations using Markdown files only. It contains a set of (optional) reveal plugins to simplify the creation of lectures.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It is primarily used by myself so it is quite opinionated and makes certains assumptions on the structure of the lecture. Markdown files should follow a certain naming pattern:
|
|
6
|
+
- Single level: `00 - Introduction.md`, `01 - Bla.md`, etc.
|
|
7
|
+
- Two level: `00 - Introduction.md`, `01 - Topic 1.md`, `01a - Sub-Topic 1.md`, `01b - Sub-Topic 1.md`, `02 - Topic 2`, etc.
|
|
8
|
+
|
|
9
|
+
The resulting files can be published on any web server and do not require server-side components. Everything is rendered by the browser.
|
|
10
|
+
|
|
11
|
+
## Requirements and Installation
|
|
12
|
+
|
|
13
|
+
To use this project, [node.js and npm](https://nodejs.org) are required.
|
|
14
|
+
|
|
15
|
+
Create a new lecture:
|
|
16
|
+
- Create a new folder and initialize an empty node.js project (e.g., `npm init --yes`)
|
|
17
|
+
- Add this package as a dependency (`npm i @farberg/reveal-template`)
|
|
18
|
+
- Read the documentation below
|
|
6
19
|
|
|
7
20
|
## Usage
|
|
8
21
|
|
|
9
22
|
1. Create a file `package.json` describing your presentation (e.g., [like this one)](docs/package.json).
|
|
10
|
-
2. Create
|
|
11
|
-
3. Create
|
|
23
|
+
2. Create an HTML file (e.g., `index.html`, see [npm.html](docs/npm.html) for an example)
|
|
24
|
+
3. Create your presentation in [Markdown](https://en.wikipedia.org/wiki/Markdown)
|
|
25
|
+
- See <a href="docs/00 - Introduction.md">this file</a> for an example).
|
|
12
26
|
- Using npm (`npm install @farberg/reveal-template`), see [npm.html](docs/npm.html) for an example.
|
|
13
|
-
- Using a CDN, see [cdn.html](docs/cdn.html) for an example ([see the published result here](https://pfisterer.github.io/reveal-template/cdn.html))
|
|
14
27
|
|
|
28
|
+
## Plugins
|
|
29
|
+
|
|
30
|
+
Click on the link for documentation
|
|
31
|
+
|
|
32
|
+
*Tested and working*
|
|
33
|
+
|
|
34
|
+
| Name | Description |
|
|
35
|
+
| -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| [reveal-plugin-dir-tree.js](http://plugins/reveal-plugin-dir-tree.js) | Create a zip from existing files for download and display a tree of files |
|
|
37
|
+
| [reveal-plugin-html-example.js](plugins/reveal-plugin-html-example.js) | Renders a code example as innerHTML of a target element |
|
|
38
|
+
| [reveal-plugin-prefix-with-base-url.js](plugins/reveal-plugin-prefix-with-base-url.js) | Prefixes the pages base URL to an element's inner Text. Optionally converts it to inline code. |
|
|
39
|
+
| [reveal-plugin-show-attribution.js](plugins/reveal-plugin-show-attribution.js) | Shows credits on the lower right corner |
|
|
40
|
+
| [reveal-plugin-show-code-snippets.js](plugins/reveal-plugin-show-code-snippets.js) | Shows a code snippet after loading it from a file. |
|
|
41
|
+
| [reveal-plugin-show-qr-code.js](plugins/reveal-plugin-show-qr-code.js) | Display a QR code and link to the presentation on the slides slides |
|
|
42
|
+
| [reveal-plugin-show-title.js](plugins/reveal-plugin-show-title.js) | Create a title slide automatically |
|
|
43
|
+
| [reveal-plugin-show-toc.js](plugins/reveal-plugin-show-toc.js) | Create a table of contents automatically (run `npx dennis_generate_toc > generated_toc.html` to generate) |
|
|
44
|
+
|
|
45
|
+
*Non-functional, untested or in development*
|
|
46
|
+
|
|
47
|
+
| Name | Description |
|
|
48
|
+
| ------------------------------------------------------------------------------ | ---------------------------------------------------- |
|
|
49
|
+
| [reveal-plugin-modify-font-size.js](plugins/reveal-plugin-modify-font-size.js) | Add keybindings `+` and `-` to change base font size |
|
|
50
|
+
| [reveal-plugin-toggle-solutions.js](plugins/reveal-plugin-toggle-solutions.js) | Show of hide solutions |
|
|
51
|
+
|
|
52
|
+
## Conversion to PDF
|
|
53
|
+
|
|
54
|
+
Run `npx dennis_generate_pdfs` to create PDFs. Requires a running [Docker](https://www.docker.com/) daemon.
|
|
15
55
|
|
|
16
56
|
## Local Development
|
|
17
57
|
|
|
18
|
-
|
|
58
|
+
To start developing on this repository:
|
|
59
|
+
- Check out this repository (`git clone https://github.com/pfisterer/reveal-template.git`)
|
|
60
|
+
- Run `npm install` to install required dependencies
|
|
61
|
+
- Start a web server from the root directory (e.g., `npx http-server -p 5500`)
|
|
62
|
+
- Open <http://localhost:5500/docs/local-dev.html>
|
|
19
63
|
|
|
20
64
|
## Publish a new version (maintainers only)
|
|
21
65
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farberg/reveal-template",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.50",
|
|
4
4
|
"homepage": "https://github.com/pfisterer/reveal-template",
|
|
5
5
|
"description": "Reveal.js template for Dennis' lectures",
|
|
6
6
|
"main": "index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"file-saver": "^2.0.5",
|
|
20
20
|
"jszip": "^3.7.1",
|
|
21
21
|
"qrcode": "^1.5.0",
|
|
22
|
-
"reveal.js": "^4.
|
|
22
|
+
"reveal.js": "^4.3.1",
|
|
23
23
|
"reveal.js-plugins": "^4.1.5",
|
|
24
|
-
"serve-static": "^1.
|
|
24
|
+
"serve-static": "^1.15.0"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Create a zip from existing files for download and display a tree of files
|
|
3
|
+
|
|
4
|
+
<pre class="dirtree" data-zipname="k8s-Exercise.zip" data-strip-prefix="code/k8s-demo-app">
|
|
5
|
+
code/k8s-demo-app/01-mariadb-deployment.yaml
|
|
6
|
+
code/k8s-demo-app/02-k8s-mariadb-service.yaml
|
|
7
|
+
code/k8s-demo-app/03-memcached-deployment-and-service.yaml
|
|
8
|
+
code/k8s-demo-app/04-app-deployment-minikube.yaml
|
|
9
|
+
code/k8s-demo-app/04-app-service-and-ingress.yaml
|
|
10
|
+
code/k8s-demo-app/Dockerfile
|
|
11
|
+
code/k8s-demo-app/package.json
|
|
12
|
+
code/k8s-demo-app/server.js
|
|
13
|
+
</pre>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
*/
|
|
18
|
+
|
|
1
19
|
const dir_tree = {
|
|
2
20
|
id: 'dir_tree',
|
|
3
21
|
init: (deck) => {
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Renders a code example as innerHTML of a target element (default is the next sibling with class html-example-output)
|
|
3
|
+
|
|
4
|
+
Parameters:
|
|
5
|
+
- data-html-destination-id: change default destination element
|
|
6
|
+
|
|
7
|
+
<h1>Willkommen im Internet</h1>
|
|
8
|
+
```
|
|
9
|
+
<!-- .element: data-html-example -->
|
|
10
|
+
|
|
11
|
+
Output
|
|
12
|
+
|
|
13
|
+
<div class="html-example-output"></div>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
1
19
|
function resizeIFrameToFitContent(iFrame) {
|
|
2
20
|
iFrame.width = iFrame.contentWindow.document.body.scrollWidth;
|
|
3
21
|
iFrame.height = iFrame.contentWindow.document.body.scrollHeight;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Prefixes the pages base URL to an element's inner Text
|
|
3
|
+
|
|
4
|
+
Parameters:
|
|
5
|
+
- data-convert-to-inline-code="language": Converts the element to an inline code element.
|
|
6
|
+
|
|
7
|
+
Example:
|
|
8
|
+
|
|
9
|
+
<span data-prefix-url data-convert-to-inline-code="bash">code/k8s-simple/pod-demo-busybox.yaml</span>
|
|
10
|
+
*/
|
|
11
|
+
|
|
1
12
|
const dir_tree = {
|
|
2
13
|
id: 'prefix_url',
|
|
3
14
|
init: (deck) => {
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Extracts data from the current slide's <credit></credit> innerHTML
|
|
3
|
+
and inserts it into the global attribution element.
|
|
4
|
+
|
|
5
|
+
Example:
|
|
6
|
+
|
|
7
|
+
<credits>Bildquelle: Some Page (<a href="https://example.com/photos/133434">example.com</a>)</credits>
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
function showAttributionOnSlide(slide) {
|
|
2
11
|
//This will set the current credits correctly
|
|
3
12
|
var creditsTag = document.getElementById("attribution");
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Shows a code snippet after loading it from a file.
|
|
3
|
+
|
|
4
|
+
Parameters:
|
|
5
|
+
- data-code: Language
|
|
6
|
+
- data-begin: Begin indicator in the file (optional)
|
|
7
|
+
- data-end: End indicator in the file (optional)
|
|
8
|
+
- data-link: Show a link to the file (optional)
|
|
9
|
+
|
|
10
|
+
Example
|
|
11
|
+
|
|
12
|
+
<a data-code='bash'
|
|
13
|
+
data-begin="# Begin indicator in the file"
|
|
14
|
+
data-end="# End indicator in the file"
|
|
15
|
+
data-link
|
|
16
|
+
href="link/to/the/file.sh">Source code</a>
|
|
17
|
+
*/
|
|
18
|
+
|
|
1
19
|
import outdent from './outdent.js'
|
|
2
20
|
|
|
3
21
|
function showError(el, err) {
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Display a QR code in a destination element by extracting data out of `package.json` and can show the URL on the slides
|
|
1
3
|
|
|
4
|
+
package.json:
|
|
5
|
+
|
|
6
|
+
{
|
|
7
|
+
[...]
|
|
8
|
+
"homepage": "http://the.url/to/the/slides"
|
|
9
|
+
[...]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
Example:
|
|
13
|
+
Show QR code:
|
|
14
|
+
<canvas class="qrcodeforslides"></canvas>
|
|
15
|
+
|
|
16
|
+
Show URL:
|
|
17
|
+
<a class="urlforslides" style="font-size: 200%"></a>
|
|
18
|
+
|
|
19
|
+
*/
|
|
2
20
|
function showLinkToSlidesAndQrCode(deck, url) {
|
|
3
21
|
if (url === undefined)
|
|
4
22
|
return
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Create a title slide automatically by reading data out of package.json to display the title slide:
|
|
3
|
+
|
|
4
|
+
package.json:
|
|
5
|
+
|
|
6
|
+
{
|
|
7
|
+
[...]
|
|
8
|
+
title: "Title of the presentation",
|
|
9
|
+
homepage: "https://the.url/to/the/slides",
|
|
10
|
+
authors: [
|
|
11
|
+
{ "name": "John Doe", homepage:"https://jon.doe.com" },
|
|
12
|
+
{ "name": "Jane Doe", homepage:"https://jane.doe.com" },
|
|
13
|
+
]
|
|
14
|
+
[...]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Example markdown:
|
|
18
|
+
<div class="lecturetitle">This is the Title of the Presentation</div>
|
|
19
|
+
*/
|
|
20
|
+
|
|
1
21
|
function showTitle(deck, packageJson) {
|
|
2
22
|
let lectureTitle = packageJson.title
|
|
3
23
|
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Loads the table of contents from a file and displays it
|
|
3
|
+
|
|
4
|
+
Parameters:
|
|
5
|
+
|
|
6
|
+
data-toc-src: Defaults to "generated_toc.html"
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
|
|
10
|
+
## Agenda
|
|
11
|
+
<!-- .slide: id="agenda" -->
|
|
12
|
+
|
|
13
|
+
<div data-toc-src="generated_toc.html" style="font-size: 0.82em;" />
|
|
14
|
+
*/
|
|
15
|
+
|
|
1
16
|
function showToc(url, el) {
|
|
2
17
|
fetch(url, { "cache": "no-store" })
|
|
3
18
|
.then(res => res.text())
|
package/docs/cdn.html
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
6
|
-
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes, minimal-ui">
|
|
8
|
-
|
|
9
|
-
<link rel="stylesheet" href="https://unpkg.com/reveal.js/dist/reveal.css">
|
|
10
|
-
<link rel="stylesheet" href="https://unpkg.com/reveal.js/plugin/highlight/zenburn.css">
|
|
11
|
-
<link rel="stylesheet" href="https://unpkg.com/@farberg/reveal-template/css/dhbw.css" id="theme">
|
|
12
|
-
|
|
13
|
-
<script type="module">
|
|
14
|
-
import { initReveal } from 'https://unpkg.com/@farberg/reveal-template/init-reveal.js'
|
|
15
|
-
const revealPath = "https://unpkg.com/reveal.js/"
|
|
16
|
-
|
|
17
|
-
initReveal({
|
|
18
|
-
indexDocument: "00 - Introduction.md",
|
|
19
|
-
revealPath: revealPath,
|
|
20
|
-
})
|
|
21
|
-
</script>
|
|
22
|
-
</head>
|
|
23
|
-
|
|
24
|
-
<body>
|
|
25
|
-
<div class="reveal">
|
|
26
|
-
<div class="slides"></div>
|
|
27
|
-
</div>
|
|
28
|
-
</body>
|