markdown-maker 1.10.0 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
package/build/parse.js DELETED
@@ -1,281 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.splice = void 0;
4
- var fs = require("fs"); /* for handling reading of files */
5
- var path = require("path"); /* for handling file paths */
6
- var Colors = require("colors.ts"); /* for adding colours to strings */
7
- Colors.enable();
8
- var marked = require("marked");
9
- var commands_1 = require("./commands");
10
- var TargetType;
11
- (function (TargetType) {
12
- TargetType[TargetType["HTML"] = 0] = "HTML";
13
- TargetType[TargetType["MARKDOWN"] = 1] = "MARKDOWN";
14
- })(TargetType || (TargetType = {}));
15
- /* parse some md
16
- * recursively with extra options */
17
- var Parser = /** @class */ (function () {
18
- function Parser(filename, clargs, opts) {
19
- /* this.working_directory */
20
- this.file = filename;
21
- if (!opts)
22
- opts = {};
23
- /* the parent parser */
24
- this.parent = opts.parent;
25
- this.line_num = 0;
26
- this.wd = path.dirname(filename);
27
- this.wd_full = path.resolve(this.wd);
28
- /* finished blob */
29
- this.blobs = {};
30
- /* all options */
31
- this.opts = {
32
- defs: {},
33
- secs: [],
34
- args: [],
35
- depth: 0,
36
- verbose: false,
37
- debug: false,
38
- max_depth: 5,
39
- use_underscore: false,
40
- toc_level: 3,
41
- allow_undefined: false,
42
- html: false,
43
- watch: false,
44
- targetType: undefined,
45
- only_warn: false,
46
- parent: undefined,
47
- isFileCallback: function (f) {
48
- if (!fs.existsSync(f))
49
- return false;
50
- return fs.readFileSync(f, "utf-8") + "\n";
51
- },
52
- };
53
- if (!clargs) {
54
- clargs = {};
55
- }
56
- /* append all commandline arguments to this */
57
- Object.assign(this.opts, clargs);
58
- Object.assign(this.opts, opts);
59
- this.raw = this.opts.isFileCallback(filename) || filename;
60
- }
61
- /**
62
- * parse wrapper for handling
63
- * preprocessing, parsing and postprocess
64
- **/
65
- Parser.prototype.parse = function () {
66
- (0, commands_1.load_extensions)(this);
67
- if (this.opts.verbose || this.opts.debug) {
68
- console.log(Colors.colors("magenta", "parsing " + this.file + ": depth=" + this.opts.depth));
69
- }
70
- if (this.opts.debug) {
71
- console.log("Parsing options:");
72
- console.log(this.opts);
73
- }
74
- /* reset sections for beginning parse */
75
- if (this.opts.depth === 0)
76
- this.opts.secs = [];
77
- var __blob;
78
- /* apply preproccessing to raw file */
79
- __blob = this.preprocess(this.raw);
80
- /* main parser instance call */
81
- __blob = this.mainparse(__blob);
82
- /**
83
- * apply postprocessing after */
84
- __blob = this.postprocess(__blob);
85
- return __blob;
86
- };
87
- Parser.prototype.mainparse = function (blob) {
88
- var _this = this;
89
- if (this.opts.verbose || this.opts.debug) {
90
- console.debug("beginning mainparse of '".concat(this.file, "'").blue);
91
- }
92
- /* main parser instance loop */
93
- blob.split("\n").forEach(function (line, lnum) {
94
- _this.line_num = lnum;
95
- /* if line looks like a title */
96
- var titleMatch = line.trim().match(/^(#+) (.+)$/);
97
- if (titleMatch) {
98
- if (_this.opts.verbose || _this.opts.debug)
99
- console.log("found toc element: " + line);
100
- /* implement toc level */
101
- var level = titleMatch[1].length;
102
- var title = titleMatch[2];
103
- _this.opts.secs.push({ level: level, title: title });
104
- if (_this.opts.debug) {
105
- console.log("updated sections:", { level: level, title: title });
106
- }
107
- }
108
- });
109
- return this.parse_commands(blob, commands_1.commands.parse);
110
- };
111
- Parser.prototype.preprocess = function (blob) {
112
- if (this.opts.verbose || this.opts.debug) {
113
- console.debug("beginning preprocess of '".concat(this.file, "'").blue);
114
- }
115
- return this.parse_commands(blob, commands_1.commands.preparse);
116
- };
117
- Parser.prototype.postprocess = function (blob) {
118
- if (this.opts.verbose || this.opts.debug) {
119
- console.debug("beginning postprocess of '".concat(this.file, "'").blue);
120
- }
121
- blob = this.parse_commands(blob, commands_1.commands.postparse);
122
- /* remove double empty lines */
123
- blob = this.remove_double_blank_lines(blob);
124
- blob = blob.trimEnd() + "\n\n";
125
- return blob;
126
- };
127
- Parser.prototype.parse_commands = function (blob, commands) {
128
- var _this = this;
129
- commands.forEach(function (command) {
130
- /* Add global flag to RegExp */
131
- var re = new RegExp(command.validator.source, (command.validator.flags || "") + "g");
132
- blob = blob.replace(re, function () {
133
- var args = [];
134
- for (var _i = 0; _i < arguments.length; _i++) {
135
- args[_i] = arguments[_i];
136
- }
137
- return command.act(args, _this) || "";
138
- });
139
- });
140
- return blob;
141
- };
142
- Parser.prototype.parse_all_commands = function (blob, commands) {
143
- var _this = this;
144
- Object.keys(commands).forEach(function (key) {
145
- blob = _this.parse_commands(blob, commands[key]);
146
- });
147
- return blob;
148
- };
149
- Parser.prototype.titleId = function (title) {
150
- var sep = this.opts.use_underscore ? "_" : "-";
151
- title = title
152
- .toLowerCase()
153
- .replace(/[^\w\s]+/g, "")
154
- .replace(/[\s_]+/g, sep);
155
- return title;
156
- };
157
- Parser.prototype.gen_toc = function () {
158
- var _this = this;
159
- var __blob = [];
160
- var tabSize = 2;
161
- var beg = "* ";
162
- var hor = " ".repeat(tabSize);
163
- this.opts.secs.forEach(function (sec) {
164
- if (sec.level > _this.opts.toc_level)
165
- return;
166
- var title = sec.title.replace(/_/g, " ");
167
- title = _this.parse_all_commands(title, commands_1.commands);
168
- var link = _this.titleId(title);
169
- var __line = hor.repeat(Math.max(sec.level - 1, 0)) + beg + "[".concat(title, "](#").concat(link, ")");
170
- __blob.push(__line);
171
- });
172
- return __blob.join("\n");
173
- };
174
- Parser.prototype.line_num_from_index = function (index) {
175
- return this.raw.substring(0, index).split("\n").length + 1;
176
- };
177
- Parser.prototype.remove_double_blank_lines = function (blob) {
178
- /* replace all triple newlines, and EOF by double newline */
179
- blob = blob.replace(/(\r\n|\n){3,}/g, "\n\n");
180
- return blob;
181
- };
182
- /* output the parsed document to bundle */
183
- Parser.prototype.to = function (bundleName, callback) {
184
- var dir = path.dirname(bundleName);
185
- if (callback === undefined)
186
- callback = function () { };
187
- if (!fs.existsSync(dir)) {
188
- fs.mkdirSync(dir, { recursive: true });
189
- }
190
- if (!this.opts.html) {
191
- this.get(TargetType.MARKDOWN, function (blob) {
192
- fs.writeFile(bundleName, blob, function () { return callback(bundleName); });
193
- });
194
- }
195
- else {
196
- var htmlFileName_1 = bundleName.replace(".md", ".html");
197
- fs.writeFile(htmlFileName_1, this.html(), function () { return callback(htmlFileName_1); });
198
- }
199
- };
200
- Parser.prototype.html = function () {
201
- var htmlFormatted = marked(this.get(TargetType.HTML));
202
- if (this.opts.watch) {
203
- return ("<script>w=new WebSocket(\"ws:localhost:7788\");w.addEventListener(\"message\",(e)=>{if(e.data==\"refresh\")location.reload();});</script>\n" +
204
- htmlFormatted);
205
- }
206
- return htmlFormatted;
207
- };
208
- Parser.prototype.get = function (targetType, callback) {
209
- /* If target type is undefined, markdown is the default */
210
- if (targetType === undefined)
211
- targetType = TargetType.MARKDOWN;
212
- if (this.blobs[targetType]) {
213
- if (callback) {
214
- callback(this.blobs[targetType]);
215
- }
216
- return this.blobs[targetType];
217
- }
218
- else {
219
- try {
220
- this.opts.targetType = targetType;
221
- var blob = this.parse();
222
- this.opts.targetType = undefined;
223
- if (callback)
224
- callback(blob);
225
- return blob;
226
- }
227
- catch (error) {
228
- /* Compile a traceback of error */
229
- var traceback = "";
230
- var p = this;
231
- do {
232
- if (error instanceof commands_1.MDMError)
233
- traceback += "\n...on line ".concat(p.line_num_from_index(error.match.index), " in ").concat(p.file).grey(15);
234
- else
235
- traceback += "\n...on line ".concat(p.line_num, " in ").concat(p.file).grey(15);
236
- if (p.parent)
237
- p = p.parent;
238
- } while (p.parent);
239
- error.message += traceback;
240
- /* only interested in node stacktrace when debugging */
241
- if (!this.opts.debug)
242
- error.stack = "";
243
- if (this.opts.only_warn)
244
- console.error(error);
245
- else
246
- throw error;
247
- }
248
- }
249
- };
250
- Parser.TOKEN = "#md";
251
- return Parser;
252
- }());
253
- function splice(str, startIndex, width, newSubStr) {
254
- var start = str.slice(0, startIndex);
255
- var end = str.slice(startIndex + width);
256
- return start + newSubStr + end;
257
- }
258
- exports.splice = splice;
259
- /* add extention to marked for classed blockquotes*/
260
- marked.use({
261
- renderer: {
262
- blockquote: function (quote) {
263
- /* find the ending, and if not, return the default */
264
- var ending = quote.match(/\{(.+)\}\s*<\/p>/);
265
- if (!ending)
266
- return "<blockquote>".concat(quote, "</blockquote>");
267
- var args = ending[1].split(" ");
268
- var classes = args.filter(function (arg) { return arg.startsWith("."); });
269
- var id = args.filter(function (arg) { return arg.startsWith("#"); });
270
- var classNames = classes.map(function (c) { return c.slice(1); });
271
- var classText = classes.length > 0 ? "class=\"".concat(classNames.join(" "), "\"") : "";
272
- var idText = id.length > 0 ? "id=\"".concat(id[0].slice(1), "\"") : "";
273
- /* remove the ending from the quote */
274
- quote = quote.replace(/\{(.+)\}\s*<\/p>/, "</p>");
275
- return "<blockquote ".concat(classText, " ").concat(idText, ">\n").concat(quote.trim(), "</blockquote>");
276
- },
277
- },
278
- });
279
- module.exports = Parser;
280
- exports.default = Parser;
281
- //# sourceMappingURL=parse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":";;;AAAA,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAmC;AAC7D,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,6BAA6B;AAE3D,kCAAqC,CAAC,mCAAmC;AACzE,MAAM,CAAC,MAAM,EAAE,CAAC;AAChB,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,uCAA0E;AAE1E,IAAK,UAGJ;AAHD,WAAK,UAAU;IACX,2CAAI,CAAA;IACJ,mDAAQ,CAAA;AACZ,CAAC,EAHI,UAAU,KAAV,UAAU,QAGd;AAED;oCACoC;AACpC;IAoCI,gBACI,QAAQ,EACR,MAAM,EACN,IAGC;QAED,4BAA4B;QAC5B,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QAErB,IAAI,CAAC,IAAI;YAAE,IAAI,GAAG,EAAE,CAAC;Q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AAC,GAAG,CAAC,EAAnB,CAAmB,CAAC,CAAC;YAC1D,IAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAnB,CAAmB,CAAC,CAAC;YAErD,IAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAV,CAAU,CAAC,CAAC;YAClD,IAAM,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAU,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,OAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9E,IAAM,MAAM,GAAG,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,eAAO,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAE7D,sCAAsC;YACtC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;YAElD,OAAO,sBAAe,SAAS,cAAI,MAAM,gBAAM,KAAK,CAAC,IAAI,EAAE,kBAAe,CAAC;QAC/E,CAAC;KACJ;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;AAExB,kBAAe,MAAM,CAAC"}
@@ -1,10 +0,0 @@
1
- declare const templates: {
2
- [key: string]: string;
3
- };
4
- /**
5
- * Function to add a template to the templates object. Similar to definitions and variables, but reside as an extension.
6
- * @param name The name of the template
7
- * @param content The replacement string
8
- */
9
- export declare function new_template(name: string, content: string): void;
10
- export default templates;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.new_template = void 0;
4
- var templates = {};
5
- /**
6
- * Function to add a template to the templates object. Similar to definitions and variables, but reside as an extension.
7
- * @param name The name of the template
8
- * @param content The replacement string
9
- */
10
- function new_template(name, content) {
11
- templates[name] = content;
12
- }
13
- exports.new_template = new_template;
14
- /* initialize default templates */
15
- var presentation_template = require("../src/templates/presentation.js");
16
- var mathjax_template = require("../src/templates/mathjax.js");
17
- new_template("presentation", presentation_template);
18
- new_template("mathjax", mathjax_template);
19
- exports.default = templates;
20
- //# sourceMappingURL=templates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":";;;AAAA,IAAM,SAAS,GAA8B,EAAE,CAAC;AAEhD;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,OAAe;IACtD,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AAC9B,CAAC;AAFD,oCAEC;AAED,kCAAkC;AAClC,IAAM,qBAAqB,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAC1E,IAAM,gBAAgB,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAChE,YAAY,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC;AACpD,YAAY,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAE1C,kBAAe,SAAS,CAAC"}
@@ -1,7 +0,0 @@
1
- {
2
- "opts": {
3
- "src": "main.md",
4
- "use-underscore": true,
5
- "html": true
6
- }
7
- }
package/doc/main.md DELETED
@@ -1,2 +0,0 @@
1
- Hello there!
2
- #mdinclude<other.md>
package/doc/other.md DELETED
@@ -1 +0,0 @@
1
- From the other siiiiiide!
package/re-test.js DELETED
@@ -1,10 +0,0 @@
1
- const s = "hello1, hello2, hello3";
2
-
3
- const re = /hello(?<digit>\d)/g;
4
-
5
- let m = s.replace(re, (match, ...args) => {
6
- console.log(args);
7
- return "world";
8
- });
9
-
10
- console.log({ s, m });