markdown-maker 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/parse.ts +10 -15
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "markdown-maker",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "",
5
5
  "main": "src/cltool.ts",
6
6
  "bin": {
7
- "parse": "build/cltool.js"
7
+ "mdparse": "build/cltool.js"
8
8
  },
9
9
  "pkg": {
10
10
  "assets": [
package/src/parse.ts CHANGED
@@ -55,7 +55,7 @@ class Parser {
55
55
  opts?: {
56
56
  parent?: Parser;
57
57
  isFileCallback?: (s: string) => false | string;
58
- },
58
+ }
59
59
  ) {
60
60
  /* this.working_directory */
61
61
  this.file = filename;
@@ -116,8 +116,8 @@ class Parser {
116
116
  console.log(
117
117
  Colors.colors(
118
118
  "magenta",
119
- "parsing " + this.file + ": depth=" + this.opts.depth,
120
- ),
119
+ "parsing " + this.file + ": depth=" + this.opts.depth
120
+ )
121
121
  );
122
122
  }
123
123
 
@@ -200,7 +200,7 @@ class Parser {
200
200
  /* Add global flag to RegExp */
201
201
  const re = new RegExp(
202
202
  command.validator.source,
203
- (command.validator.flags || "") + "g",
203
+ (command.validator.flags || "") + "g"
204
204
  );
205
205
  blob = blob.replace(re, (...args) => command.act(args, this) || "");
206
206
  });
@@ -237,9 +237,7 @@ class Parser {
237
237
  const link = this.titleId(title);
238
238
 
239
239
  let __line =
240
- hor.repeat(Math.max(sec.level - 1, 0)) +
241
- beg +
242
- `[${title}](#${link})`;
240
+ hor.repeat(Math.max(sec.level - 1, 0)) + beg + `[${title}](#${link})`;
243
241
 
244
242
  __blob.push(__line);
245
243
  });
@@ -264,7 +262,7 @@ class Parser {
264
262
  if (callback === undefined) callback = () => {};
265
263
 
266
264
  if (!fs.existsSync(dir)) {
267
- fs.mkdirSync(dir);
265
+ fs.mkdirSync(dir, { recursive: true });
268
266
  }
269
267
  this.get(TargetType.MARKDOWN, (blob) => {
270
268
  fs.writeFile(bundleName, blob, () => {
@@ -318,11 +316,9 @@ class Parser {
318
316
  do {
319
317
  if (error instanceof MDMError)
320
318
  traceback += `\n...on line ${p.line_num_from_index(
321
- error.match.index,
319
+ error.match.index
322
320
  )} in ${p.file}`.grey(15);
323
- else
324
- traceback +=
325
- `\n...on line ${p.line_num} in ${p.file}`.grey(15);
321
+ else traceback += `\n...on line ${p.line_num} in ${p.file}`.grey(15);
326
322
  if (p.parent) p = p.parent;
327
323
  } while (p.parent);
328
324
 
@@ -342,7 +338,7 @@ export function splice(
342
338
  str: string,
343
339
  startIndex: number,
344
340
  width: number,
345
- newSubStr: string,
341
+ newSubStr: string
346
342
  ) {
347
343
  const start = str.slice(0, startIndex);
348
344
  const end = str.slice(startIndex + width);
@@ -363,8 +359,7 @@ marked.use({
363
359
  const id = args.filter((arg) => arg.startsWith("#"));
364
360
 
365
361
  const classNames = classes.map((c) => c.slice(1));
366
- const classText =
367
- classes.length > 0 ? `class="${classNames.join(" ")}"` : "";
362
+ const classText = classes.length > 0 ? `class="${classNames.join(" ")}"` : "";
368
363
  const idText = id.length > 0 ? `id="${id[0].slice(1)}"` : "";
369
364
 
370
365
  /* remove the ending from the quote */