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.
- package/bundle/cltool.d.ts +86 -0
- package/bundle/cltool.js +63 -0
- package/bundle/cltool.js.map +1 -0
- package/bundle/commands.d.ts +23 -0
- package/bundle/commands.js +303 -0
- package/bundle/commands.js.map +1 -0
- package/bundle/errors.d.ts +11 -0
- package/bundle/errors.js +51 -0
- package/bundle/errors.js.map +1 -0
- package/bundle/main.d.ts +6 -0
- package/bundle/main.js +152 -0
- package/bundle/main.js.map +1 -0
- package/bundle/parser.d.ts +35 -0
- package/bundle/parser.js +330 -0
- package/bundle/parser.js.map +1 -0
- package/bundle/templates/mathjax.d.ts +2 -0
- package/bundle/templates/mathjax.js +3 -0
- package/bundle/templates/mathjax.js.map +1 -0
- package/bundle/templates/presentation.d.ts +2 -0
- package/bundle/templates/presentation.js +3 -0
- package/bundle/templates/presentation.js.map +1 -0
- package/bundle/templates.d.ts +10 -0
- package/bundle/templates.js +23 -0
- package/bundle/templates.js.map +1 -0
- package/bundle/types.d.ts +28 -0
- package/bundle/types.js +15 -0
- package/bundle/types.js.map +1 -0
- package/bundle/version.d.ts +1 -0
- package/bundle/version.js +5 -0
- package/bundle/version.js.map +1 -0
- package/package.json +2 -1
- package/src/cltool.ts +3 -2
- package/src/commands.ts +22 -0
- package/src/main.ts +4 -0
- package/src/version.ts +1 -0
- package/tests/advanced.spec.ts +10 -0
@@ -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 @@
|
|
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
|
+
"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
|
-
|
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 =
|
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";
|
package/tests/advanced.spec.ts
CHANGED
@@ -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
|
+
});
|