markdown-maker 1.10.3 → 1.10.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAqBA,IAAY,WAIX;AAJD,WAAY,WAAW;IACtB,qDAAQ,CAAA;IACR,+CAAK,CAAA;IACL,uDAAS,CAAA;AACV,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAED,IAAY,UAGX;AAHD,WAAY,UAAU;IACrB,2CAAI,CAAA;IACJ,mDAAQ,CAAA;AACT,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"}
@@ -0,0 +1 @@
1
+ export declare const LIB_VERSION = "1.10.4";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LIB_VERSION = void 0;
4
+ exports.LIB_VERSION = "1.10.4";
5
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "markdown-maker",
3
- "version": "1.10.3",
3
+ "version": "1.10.5",
4
4
  "description": "A superset-compiler for markdown using marked",
5
5
  "main": "src/main.ts",
6
6
  "bin": {
7
7
  "mdparse": "bundle/main.js"
8
8
  },
9
9
  "scripts": {
10
+ "prebundle": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
10
11
  "test": "jest",
11
12
  "bundle": "tsc --project tsconfig.json",
12
13
  "main": "node bundle/main.js",
package/src/cltool.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import fs from "fs"; /* for handling reading of files */
2
2
  import path from "path"; /* for handling file paths */
3
3
 
4
- import Colors = require("colors.ts"); /* for adding colours to strings */
4
+ const Colors = require("colors.ts"); /* for adding colours to strings */
5
5
  import { TaggedElement, TargetType } from "./types";
6
+ import { LIB_VERSION } from "./version";
6
7
  import Parser from "./parser";
7
8
 
8
- const version = process.env.npm_package_version || "0.0.0";
9
+ const version = LIB_VERSION;
9
10
 
10
11
  Colors.enable();
11
12
  import { ArgumentParser } from "argparse"; /* for parsing clargs */
package/src/commands.ts CHANGED
@@ -261,6 +261,28 @@ new Command(
261
261
  CommandType.POSTPARSE
262
262
  );
263
263
 
264
+ new Command(
265
+ /<(\w+)([\#\.\w]+)\n([\w\W]*?)>/,
266
+ (match, _) => {
267
+ const tag = match[1];
268
+ const tagline = match[2];
269
+ const id = tagline.match(/#(\w+)/)
270
+ ? `id="${tagline.match(/#(\w+)/)[1]}"`
271
+ : "";
272
+ const cls = tagline.match(/\.(.+)/);
273
+ let cls_str = "";
274
+ if (cls) {
275
+ cls_str =
276
+ cls.length > 1 ? `class="${cls[1].replace(".", " ")}"` : "";
277
+ }
278
+
279
+ const content = match[3];
280
+
281
+ return `<${tag} ${id} ${cls_str}>${content.trim()}</${tag}>`;
282
+ },
283
+ CommandType.POSTPARSE
284
+ );
285
+
264
286
  const loaded_extentions: fs.PathLike[] = [];
265
287
 
266
288
  function load_extension(parser: Parser, file: fs.PathLike) {
package/src/main.ts CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  import path from "path";
2
4
  import { WebSocketServer } from "ws";
3
5
  import * as fs from "fs";
@@ -10,6 +12,7 @@ import { enable as ColorsEnable } from "colors.ts";
10
12
  ColorsEnable();
11
13
 
12
14
  import { argParser, CommandLineArgs, ParserOptions } from "./cltool";
15
+ import { log } from "console";
13
16
  const configFileName = ".mdmconfig.json";
14
17
 
15
18
  function main() {
@@ -54,6 +57,7 @@ function main() {
54
57
  );
55
58
  fs.writeFileSync(configFileName, template);
56
59
  fs.writeFileSync("main.md", "# Main\n");
60
+ console.log(`Created config file ${configFileName.green}`);
57
61
  return;
58
62
  }
59
63
 
package/src/version.ts ADDED
@@ -0,0 +1 @@
1
+ export const LIB_VERSION = "1.10.4";
@@ -90,3 +90,13 @@ describe("Use of markdown hooks for SSR", () => {
90
90
  util.expect(output).toBe("<p>hello</p><p>!</p><p>world</p>\n\n");
91
91
  });
92
92
  });
93
+
94
+ describe("Emmet-style html elements", () => {
95
+ const parser = new util.Parser("<div#id.cls1.cls2\nHello!>");
96
+
97
+ it("should parse emmet-style elements", () => {
98
+ util.expect(parser.get()).toBe(
99
+ '<div id="id" class="cls1 cls2">Hello!</div>\n\n'
100
+ );
101
+ });
102
+ });