marp-dev-preview 0.0.1 → 0.0.3

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 CHANGED
@@ -10,10 +10,18 @@ The tool is mainly intended for slide deck authors who want to preview their sli
10
10
  * Automatic browser reload on file changes.
11
11
  * Custom theme support.
12
12
  * Keyboard navigation for slides.
13
- * Also installs and uses the following markdown-it plugins:
13
+ * Also installs and uses the following markdown-it plugins (it's easy to add more if needed):
14
14
  * `markdown-it-container`
15
15
  * `markdown-it-mark`
16
16
  * `markdown-it-footnote`
17
+
18
+ ## Usage via npx
19
+
20
+ The simplest way to start the previewer is via npx:
21
+
22
+ ```bash
23
+ npx marp-dev-preview --theme-dir <dir containing your themes> <your presentation>.md
24
+ ```
17
25
 
18
26
  ## Installation
19
27
 
@@ -31,16 +39,16 @@ npm install marp-dev-preview
31
39
 
32
40
  ## Usage
33
41
 
34
- To start the preview server, run the `mp` command followed by your markdown file path:
42
+ To start the preview server, run the `mdp` command followed by your markdown file path:
35
43
 
36
44
  ```bash
37
- mp <path-to-your-markdown-file.md> [options]
45
+ mdp <path-to-your-markdown-file> [options]
38
46
  ```
39
47
 
40
48
  **Example:**
41
49
 
42
50
  ```bash
43
- mp my-slides/presentation.md --port 3000 --theme-dir my-themes
51
+ mdp my-slides/presentation.md --port 3000 --theme-dir my-themes
44
52
  ```
45
53
 
46
54
  ### Options
@@ -57,14 +65,6 @@ While viewing the presentation in your browser, in addition to the usual browser
57
65
  * <kbd>:&lt;number&gt;</kbd>: Go to the specified slide number.
58
66
  * <kbd>?</kbd>: Toggle the help box displaying key bindings.
59
67
 
60
- ## Development
61
-
62
- If you are contributing to the development of this tool, you can run it locally using:
63
-
64
- ```bash
65
- npm run preview -- <path-to-your-markdown-file.md>
66
- ```
67
-
68
68
  ## License
69
69
 
70
70
  This project is licensed under the MIT License - see the `LICENSE` file for details.
@@ -7,6 +7,9 @@ import chokidar from 'chokidar';
7
7
  import { WebSocketServer } from 'ws';
8
8
  import yargs from 'yargs';
9
9
  import { hideBin } from 'yargs/helpers';
10
+ import markdownItFootnote from 'markdown-it-footnote';
11
+ import markdownItMark from 'markdown-it-mark';
12
+ import markdownItContainer from 'markdown-it-container';
10
13
 
11
14
  const argv = yargs(hideBin(process.argv))
12
15
  .usage('Usage: $0 <markdown-file> [options]')
@@ -65,7 +68,11 @@ let marp;
65
68
 
66
69
  async function initializeMarp() {
67
70
  const options = { html: true, linkify: true, };
68
- marp = new Marp(options);
71
+ marp = new Marp(options)
72
+ .use(markdownItFootnote)
73
+ .use(markdownItMark)
74
+ .use(markdownItContainer, 'note');
75
+
69
76
  if (themeDir) {
70
77
  const themeFiles = await fs.readdir(themeDir);
71
78
  for (const file of themeFiles) {
@@ -217,6 +224,7 @@ async function renderMarp() {
217
224
  });
218
225
  });
219
226
  </script>
227
+ <meta charset="UTF-8">
220
228
  </head>
221
229
  <body>
222
230
  ${html}
@@ -240,7 +248,7 @@ const server = http.createServer(async (req, res) => {
240
248
  try {
241
249
  if (req.url === '/') {
242
250
  const html = await renderMarp();
243
- res.writeHead(200, { 'Content-Type': 'text/html' });
251
+ res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
244
252
  res.end(html);
245
253
  } else {
246
254
  const assetPath = path.join(markdownDir, req.url);
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "marp-dev-preview",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "A CLI tool to preview Marp markdown files.",
5
- "main": "marp-preview.mjs",
5
+ "main": "marp-dev-preview.mjs",
6
6
  "type": "module",
7
7
  "bin": {
8
- "mp":"./marp-preview.mjs"
8
+ "mdp":"./marp-dev-preview.mjs"
9
9
  },
10
10
  "scripts": {
11
- "start": "node marp-preview.mjs",
12
- "preview": "node marp-preview.mjs"
11
+ "start": "node marp-dev-preview.mjs"
13
12
  },
14
13
  "keywords": [
15
14
  "marp",
@@ -18,7 +17,9 @@
18
17
  "cli"
19
18
  ],
20
19
  "author": "Roberto Esposito",
21
- "licence": "MIT",
20
+ "license": "MIT",
21
+ "repository": "git@github.com:boborbt/marp-dev-preview.git",
22
+ "bugs": "https://github.com/boborbt/marp-dev-preview/issues",
22
23
  "dependencies": {
23
24
  "@marp-team/marp-core": "^4.1.0",
24
25
  "chokidar": "^4.0.3",