marp-cue 0.1.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 +25 -0
- package/cli.js +7 -0
- package/marp.config.js +10 -0
- package/package.json +31 -0
- package/themes/teleprompter-observer.js +29 -0
- package/themes/teleprompter.css +27 -0
- package/themes/teleprompter.js +15 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Terhorst-North
|
|
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,25 @@
|
|
|
1
|
+
# Recording decks using Markdown
|
|
2
|
+
|
|
3
|
+
So I seem to have written a markdown-teleprompter-slideshow thing that works insanely well. No autoscroll, this is for 'speaker notes' type scripts rather than verbatim autocue. Gojko Adzic has a [lovely browser tool](https://gojko.net/tools/teleprompter/) for that.
|
|
4
|
+
|
|
5
|
+
- H2 headings (`##`) separate slides
|
|
6
|
+
- Active bullet highlighted, the rest dim
|
|
7
|
+
- Sub-bullets highlighted a different colour
|
|
8
|
+
- Scrolls current bullet to middle of viewport so it is always centred ('typewriter mode') and you aren't reading up and down the screen
|
|
9
|
+
- Uses MARP, so arrow keys, home/end, clicker all do what you would expect
|
|
10
|
+
- Live update: edit the markdown, view hot-reloads
|
|
11
|
+
- Installable as Chrome or Safari 'app' to remove the browser cruft
|
|
12
|
+
- Theme-able, everything except scroll-centring is CSS
|
|
13
|
+
I am using [MARP](https://marp.app/) to render my Markdown notes as nicely formatted presentation notes with a highlighted bullets.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Put the following frontmatter in your Markdown file:
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
---
|
|
21
|
+
marp: true
|
|
22
|
+
headingDivider: 2
|
|
23
|
+
class: invert
|
|
24
|
+
---
|
|
25
|
+
```
|
package/cli.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { marpCli } from '@marp-team/marp-cli';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
5
|
+
|
|
6
|
+
const config = join(dirname(fileURLToPath(import.meta.url)), 'marp.config.js');
|
|
7
|
+
process.exit(await marpCli(['--config', config, ...process.argv.slice(2)]));
|
package/marp.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "marp-cue",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Teleprompter-style scrolling for Marp presentations",
|
|
5
|
+
"author": "Daniel Terhorst-North <daniel@dannorth.net>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"marp",
|
|
9
|
+
"teleprompter",
|
|
10
|
+
"presentation",
|
|
11
|
+
"markdown",
|
|
12
|
+
"slides"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://gitlab.com/tastapod/marp-cue.git"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"bin": {
|
|
20
|
+
"marp-cue": "./cli.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"cli.js",
|
|
24
|
+
"marp.config.js",
|
|
25
|
+
"themes/",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@marp-team/marp-cli": "^4.2.0"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const observer = new MutationObserver((mutations) => {
|
|
2
|
+
for (const mutation of mutations) {
|
|
3
|
+
// Scroll the active bullet to the centre of the viewport
|
|
4
|
+
if (mutation.attributeName === "data-bespoke-marp-current-fragment" &&
|
|
5
|
+
mutation.target.tagName === "LI" &&
|
|
6
|
+
mutation.target.hasAttribute("data-bespoke-marp-current-fragment")
|
|
7
|
+
) {
|
|
8
|
+
mutation.target.scrollIntoView({ block: "center", behavior: "smooth" });
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// On slide change, centre the active fragment or the heading
|
|
13
|
+
if (mutation.attributeName === "class" &&
|
|
14
|
+
mutation.target.classList.contains("bespoke-marp-active")
|
|
15
|
+
) {
|
|
16
|
+
const section = mutation.target.querySelector("section");
|
|
17
|
+
const selectedLine = section?.querySelector("[data-bespoke-marp-current-fragment]");
|
|
18
|
+
const heading = section?.querySelector("h1, h2, h3");
|
|
19
|
+
(selectedLine || heading)?.scrollIntoView({ block: "center", behavior: "instant" });
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
observer.observe(document.body, {
|
|
26
|
+
attributes: true,
|
|
27
|
+
attributeFilter: ["data-bespoke-marp-current-fragment", "class"],
|
|
28
|
+
subtree: true,
|
|
29
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* @theme teleprompter */
|
|
2
|
+
|
|
3
|
+
@import 'uncover';
|
|
4
|
+
|
|
5
|
+
/* Dim inactive lines */
|
|
6
|
+
li[data-bespoke-marp-fragment] {
|
|
7
|
+
|
|
8
|
+
color: darkgray;
|
|
9
|
+
visibility: visible;
|
|
10
|
+
|
|
11
|
+
/* Highlight current line */
|
|
12
|
+
&[data-bespoke-marp-current-fragment] {
|
|
13
|
+
color: white;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
li[data-bespoke-marp-fragment] {
|
|
17
|
+
font-size: smaller;
|
|
18
|
+
&[data-bespoke-marp-current-fragment] {
|
|
19
|
+
color: cyan;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Add enough vertical space around the slide to centre the current line */
|
|
25
|
+
section:has([data-bespoke-marp-fragment]) {
|
|
26
|
+
padding-block: 80vh;
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { dirname, join } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
const script = readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'teleprompter-observer.js'), 'utf8');
|
|
6
|
+
|
|
7
|
+
export default ({ marp }) => {
|
|
8
|
+
const originalRender = marp.render.bind(marp);
|
|
9
|
+
marp.render = (...args) => {
|
|
10
|
+
const result = originalRender(...args);
|
|
11
|
+
result.html += '<script>' + script + '</script>';
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
return marp;
|
|
15
|
+
};
|