marp-dev-preview 0.2.2 → 0.3.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/package.json +1 -1
- package/src/args.mjs +6 -0
- package/src/marp-dev-preview.mjs +3 -2
- package/src/marp-utils.mjs +6 -3
package/package.json
CHANGED
package/src/args.mjs
CHANGED
|
@@ -9,6 +9,12 @@ export function parseArgs() {
|
|
|
9
9
|
describe: 'Path to the markdown file to preview',
|
|
10
10
|
type: 'string'
|
|
11
11
|
})
|
|
12
|
+
.option('containers', {
|
|
13
|
+
alias: 'c',
|
|
14
|
+
describe: 'containers for the markdown-it-containers plugin',
|
|
15
|
+
type: 'array',
|
|
16
|
+
default: ["note", "info", "warning", "details"]
|
|
17
|
+
})
|
|
12
18
|
.option('theme-set', {
|
|
13
19
|
alias: 't',
|
|
14
20
|
describe: 'Directories for custom themes',
|
package/src/marp-dev-preview.mjs
CHANGED
|
@@ -20,6 +20,7 @@ const markdownFile = argv.markdownFile;
|
|
|
20
20
|
const themeSet = argv.themeSet;
|
|
21
21
|
const port = argv.port;
|
|
22
22
|
const verbose = argv.verbose;
|
|
23
|
+
const containers = argv.containers;
|
|
23
24
|
|
|
24
25
|
if (argv.version) {
|
|
25
26
|
const pkg = JSON.parse(await fs.readFile(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
|
@@ -159,14 +160,14 @@ if (themeSet) {
|
|
|
159
160
|
console.debug('Reloading theme from file :', file);
|
|
160
161
|
|
|
161
162
|
console.debug(`Theme file ${file} changed, updating...`);
|
|
162
|
-
await initializeMarp(themeSet);
|
|
163
|
+
await initializeMarp(themeSet, containers);
|
|
163
164
|
const md = await fs.readFile(markdownFile, 'utf8');
|
|
164
165
|
await reload(md);
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
initializeMarp(themeSet).then(() => {
|
|
170
|
+
initializeMarp(themeSet, containers).then(() => {
|
|
170
171
|
const app = createServer(markdownDir, renderMarp, reload, wss, __dirname);
|
|
171
172
|
const server = http.createServer(app);
|
|
172
173
|
|
package/src/marp-utils.mjs
CHANGED
|
@@ -13,12 +13,15 @@ export function getMarp() {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export async function initializeMarp(themeSet) {
|
|
16
|
+
export async function initializeMarp(themeSet, containers) {
|
|
17
17
|
const options = { html: true, linkify: true, };
|
|
18
18
|
marp = new Marp(options)
|
|
19
19
|
.use(markdownItFootnote)
|
|
20
|
-
.use(markdownItMark)
|
|
21
|
-
|
|
20
|
+
.use(markdownItMark);
|
|
21
|
+
|
|
22
|
+
for (const container of containers) {
|
|
23
|
+
marp = marp.use(markdownItContainer, container);
|
|
24
|
+
}
|
|
22
25
|
|
|
23
26
|
if (!themeSet) {
|
|
24
27
|
return marp;
|