markdown-maker 1.10.2 → 1.10.4

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.
Files changed (68) hide show
  1. package/.github/workflows/node.js.yml +21 -26
  2. package/.vscode/extensions.json +3 -0
  3. package/.vscode/settings.json +8 -3
  4. package/.vscode/snippets.code-snippets +6 -8
  5. package/bundle/cltool.d.ts +86 -0
  6. package/bundle/cltool.js +63 -0
  7. package/bundle/cltool.js.map +1 -0
  8. package/bundle/commands.d.ts +23 -0
  9. package/bundle/commands.js +303 -0
  10. package/bundle/commands.js.map +1 -0
  11. package/bundle/errors.d.ts +11 -0
  12. package/bundle/errors.js +51 -0
  13. package/bundle/errors.js.map +1 -0
  14. package/bundle/main.d.ts +6 -0
  15. package/bundle/main.js +152 -0
  16. package/bundle/main.js.map +1 -0
  17. package/bundle/parser.d.ts +35 -0
  18. package/bundle/parser.js +330 -0
  19. package/bundle/parser.js.map +1 -0
  20. package/bundle/templates/mathjax.d.ts +2 -0
  21. package/bundle/templates/mathjax.js +3 -0
  22. package/bundle/templates/mathjax.js.map +1 -0
  23. package/bundle/templates/presentation.d.ts +2 -0
  24. package/bundle/templates/presentation.js +3 -0
  25. package/bundle/templates/presentation.js.map +1 -0
  26. package/bundle/templates.d.ts +10 -0
  27. package/bundle/templates.js +23 -0
  28. package/bundle/templates.js.map +1 -0
  29. package/bundle/types.d.ts +28 -0
  30. package/bundle/types.js +15 -0
  31. package/bundle/types.js.map +1 -0
  32. package/bundle/version.d.ts +1 -0
  33. package/bundle/version.js +5 -0
  34. package/bundle/version.js.map +1 -0
  35. package/jest.config.js +7 -0
  36. package/package.json +42 -40
  37. package/src/cltool.ts +115 -72
  38. package/src/commands.ts +257 -241
  39. package/src/errors.ts +26 -0
  40. package/src/main.ts +114 -109
  41. package/src/parser.ts +378 -350
  42. package/src/templates.ts +5 -1
  43. package/src/types.ts +33 -0
  44. package/src/version.ts +1 -0
  45. package/tests/_test-util.ts +44 -0
  46. package/tests/advanced.spec.ts +102 -0
  47. package/tests/basic.spec.ts +68 -0
  48. package/tests/clargs.spec.ts +50 -0
  49. package/tests/errors.spec.ts +64 -0
  50. package/tests/html.spec.ts +23 -0
  51. package/tests/line.spec.ts +21 -0
  52. package/tests/marked.spec.ts +40 -0
  53. package/tests/target.spec.ts +41 -0
  54. package/tests/vars.spec.ts +45 -0
  55. package/tsconfig.json +66 -64
  56. package/prettierrc.yaml +0 -4
  57. package/test/advanced.test.js +0 -34
  58. package/test/basic.test.js +0 -67
  59. package/test/clargs.test.js +0 -51
  60. package/test/errors.test.js +0 -47
  61. package/test/hooks.js +0 -9
  62. package/test/hooks.test.js +0 -114
  63. package/test/html.test.js +0 -37
  64. package/test/line.test.js +0 -21
  65. package/test/marked.test.js +0 -43
  66. package/test/target.test.js +0 -43
  67. package/test/tester.test.js +0 -41
  68. package/test/vars.test.js +0 -49
@@ -1,35 +1,30 @@
1
1
  # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
2
  # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
3
 
4
- name: Mocha
4
+ name: Jest
5
5
 
6
6
  on: [push, pull_request]
7
7
 
8
8
  jobs:
9
- build:
9
+ build:
10
+ runs-on: ubuntu-latest
10
11
 
11
- runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ node-version: [20.x, 21.x, 22.x]
15
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
12
16
 
13
- strategy:
14
- matrix:
15
- node-version: [16.x, 18.x, 20.x]
16
- # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
17
-
18
- steps:
19
- - uses: actions/checkout@v2
20
- - name: Use Node.js ${{ matrix.node-version }}
21
- uses: actions/setup-node@v1
22
- with:
23
- node-version: ${{ matrix.node-version }}
24
- - name: yarn install
25
- uses: borales/actions-yarn@v3.0.0
26
- with:
27
- cmd: install # will run `yarn install` command
28
- - name: yarn build
29
- uses: borales/actions-yarn@v3.0.0
30
- with:
31
- cmd: build # will run `yarn build` command
32
- - name: yarn test
33
- uses: borales/actions-yarn@v3.0.0
34
- with:
35
- cmd: test # will run `yarn test` command
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Use Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v1
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+ - name: yarn install
24
+ uses: borales/actions-yarn@v3.0.0
25
+ with:
26
+ cmd: install # will run `yarn install` command
27
+ - name: yarn test
28
+ uses: borales/actions-yarn@v3.0.0
29
+ with:
30
+ cmd: test # will run `yarn test` command
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["orta.vscode-jest", "github.vscode-github-actions"]
3
+ }
@@ -1,5 +1,10 @@
1
1
  {
2
- "editor.formatOnPaste": true,
3
- "editor.defaultFormatter": "esbenp.prettier-vscode",
4
- "prettier.tabWidth": 4
2
+ "editor.formatOnPaste": true,
3
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
4
+ "prettier.tabWidth": 4,
5
+ "prettier.useEditorConfig": true,
6
+ "prettier.configPath": "",
7
+ "prettier.requireConfig": false,
8
+ "prettier.useTabs": true,
9
+ "jest.jestCommandLine": "npx jest -i"
5
10
  }
@@ -1,9 +1,9 @@
1
1
  {
2
- // Place your markdown-maker workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3
- // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4
- // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5
- // used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6
- // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
2
+ // Place your markdown-maker workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3
+ // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4
+ // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5
+ // used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6
+ // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7
7
  // Placeholders with the same ids are connected.
8
8
  // Example:
9
9
  // "Print to console": {
@@ -15,7 +15,7 @@
15
15
  // ],
16
16
  // "description": "Log output to console"
17
17
  // }
18
- "MD Command" : {
18
+ "MD Command": {
19
19
  "scope": "javascript,typescript",
20
20
  "prefix": "cummy",
21
21
  "body": [
@@ -27,6 +27,4 @@
27
27
  ],
28
28
  "description": "Snippet for a new command"
29
29
  }
30
-
31
30
  }
32
-
@@ -0,0 +1,86 @@
1
+ import { TaggedElement, TargetType } from "./types";
2
+ import Parser from "./parser";
3
+ import { ArgumentParser } from "argparse";
4
+ export declare const argParser: ArgumentParser;
5
+ export type CommandLineArgs = {
6
+ src: string;
7
+ output: string;
8
+ verbose: boolean;
9
+ debug: boolean;
10
+ max_depth: number;
11
+ entry: string;
12
+ watch: boolean;
13
+ use_underscore: boolean;
14
+ toc_level: number;
15
+ html: boolean;
16
+ allow_undefined: boolean;
17
+ };
18
+ export type IncompleteCommandLineArgs = {
19
+ src?: string;
20
+ output?: string;
21
+ verbose?: boolean;
22
+ debug?: boolean;
23
+ max_depth?: number;
24
+ entry?: string;
25
+ watch?: boolean;
26
+ use_underscore?: boolean;
27
+ toc_level?: number;
28
+ html?: boolean;
29
+ allow_undefined?: boolean;
30
+ };
31
+ export type ParserOptions = {
32
+ defs: {
33
+ [key: string]: string;
34
+ };
35
+ secs: {
36
+ level: number;
37
+ title: string;
38
+ }[];
39
+ args: string[];
40
+ depth: number;
41
+ verbose: boolean;
42
+ debug: boolean;
43
+ max_depth: number;
44
+ use_underscore: boolean;
45
+ toc_level: number;
46
+ allow_undefined: boolean;
47
+ html: boolean;
48
+ watch: boolean;
49
+ targetType: TargetType | undefined;
50
+ only_warn: boolean;
51
+ parent?: Parser;
52
+ hooks: {
53
+ [key: string]: (map: {
54
+ [tag: string]: TaggedElement;
55
+ }) => void;
56
+ };
57
+ isFileCallback: (s: string) => false | string;
58
+ };
59
+ export type IncompleteParserOptions = {
60
+ defs?: {
61
+ [key: string]: string;
62
+ };
63
+ secs?: {
64
+ level: number;
65
+ title: string;
66
+ }[];
67
+ args?: string[];
68
+ depth?: number;
69
+ verbose?: boolean;
70
+ debug?: boolean;
71
+ max_depth?: number;
72
+ use_underscore?: boolean;
73
+ toc_level?: number;
74
+ allow_undefined?: boolean;
75
+ html?: boolean;
76
+ watch?: boolean;
77
+ targetType?: TargetType | undefined;
78
+ only_warn?: boolean;
79
+ parent?: Parser;
80
+ hooks?: {
81
+ [key: string]: (map: {
82
+ [tag: string]: TaggedElement;
83
+ }) => void;
84
+ };
85
+ isFileCallback?: (s: string) => false | string;
86
+ };
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.argParser = void 0;
4
+ var Colors = require("colors.ts"); /* for adding colours to strings */
5
+ var version_1 = require("./version");
6
+ var version = version_1.LIB_VERSION;
7
+ Colors.enable();
8
+ var argparse_1 = require("argparse"); /* for parsing clargs */
9
+ exports.argParser = new argparse_1.ArgumentParser({
10
+ description: "Markdown bundler, with extra options. Extension file is loaded from ./extensions.js, if it exists",
11
+ prog: "mdparse",
12
+ });
13
+ //#region command line args
14
+ exports.argParser.add_argument("src", {
15
+ help: "file to be parsed. If this is a directory, it looks for entry point in the directory, see --entry",
16
+ });
17
+ exports.argParser.add_argument("--version", {
18
+ action: "version",
19
+ version: "v".concat(version),
20
+ });
21
+ exports.argParser.add_argument("-v", "--verbose", {
22
+ action: "store_true",
23
+ help: "enable verbose output",
24
+ });
25
+ exports.argParser.add_argument("-D", "--debug", {
26
+ action: "store_true",
27
+ help: "enable debugging information",
28
+ });
29
+ exports.argParser.add_argument("-o", "--output", {
30
+ help: "destination of bundle, by default is 'dist/bundle.md'",
31
+ default: "dist/bundle.md",
32
+ });
33
+ exports.argParser.add_argument("-d", "--max-depth", {
34
+ help: "maximum recursion depth, by default is 15",
35
+ default: 15,
36
+ type: "int",
37
+ });
38
+ exports.argParser.add_argument("-e", "--entry", {
39
+ help: "assign entry point in directory, by default is 'main.md'",
40
+ default: "main.md",
41
+ });
42
+ exports.argParser.add_argument("-w", "--watch", {
43
+ action: "store_true",
44
+ help: "recompile after a change in target target file or directory.",
45
+ });
46
+ exports.argParser.add_argument("-u", "--use-underscore", {
47
+ action: "store_true",
48
+ help: "set the parser to use '_' as seperator in ids for Table of Content. If the links in the table does not work, this is likely to be the issue.",
49
+ });
50
+ exports.argParser.add_argument("-t", "--toc-level", {
51
+ help: "the section level of the table of contents, by default is 3",
52
+ default: 3,
53
+ type: "int",
54
+ });
55
+ exports.argParser.add_argument("-H", "--html", {
56
+ action: "store_true",
57
+ help: "compile HTML from the parsed markdown",
58
+ });
59
+ exports.argParser.add_argument("--allow-undefined", "-A", {
60
+ action: "store_true",
61
+ help: "allow the use of the \"<thing>\" syntax, without raising an error when 'thing' is not a variable. Mostly useful when writing inline html tags, and other non-strictly markdown related uses",
62
+ });
63
+ //# sourceMappingURL=cltool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cltool.js","sourceRoot":"","sources":["../src/cltool.ts"],"names":[],"mappings":";;;AAGA,IAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,mCAAmC;AAExE,qCAAwC;AAGxC,IAAM,OAAO,GAAG,qBAAW,CAAC;AAE5B,MAAM,CAAC,MAAM,EAAE,CAAC;AAChB,qCAA0C,CAAC,wBAAwB;AAGtD,QAAA,SAAS,GAAG,IAAI,yBAAc,CAAC;IAC3C,WAAW,EACV,mGAAmG;IACpG,IAAI,EAAE,SAAS;CACf,CAAC,CAAC;AAEH,2BAA2B;AAC3B,iBAAS,CAAC,YAAY,CAAC,KAAK,EAAE;IAC7B,IAAI,EAAE,mGAAmG;CACzG,CAAC,CAAC;AACH,iBAAS,CAAC,YAAY,CAAC,WAAW,EAAE;IACnC,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,WAAI,OAAO,CAAE;CACtB,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jD,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,6LAA6L;CACnM,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import Parser from "./parser";
2
+ import { CommandGroupType, CommandType } from "./types";
3
+ export declare const commands: CommandGroupType;
4
+ export declare class Command {
5
+ validator: RegExp;
6
+ acter: (match: RegExpExecArray, parser: Parser) => string | void;
7
+ type: CommandType;
8
+ constructor(validator: RegExp, acter: (match: RegExpExecArray, parser: Parser) => string | void, type: CommandType);
9
+ act(match: RegExpExecArray, parser: Parser): string | void;
10
+ }
11
+ export declare function load_extensions(parser: Parser): void;
12
+ /**
13
+ *
14
+ * @param regex The regex to match the command
15
+ * @param acter The function called when a match is found. Takes two arguments, `match` and `parser`. `match` is the result of the regex match, and `parser` is the parser instance. The function should return the replacement string.
16
+ * @param type When the command should be run. Can be `CommandType.PREPARSE`, `CommandType.PARSE`, or `CommandType.POSTPARSE`. Defaults to `CommandType.PARSE`.
17
+ */
18
+ export declare function new_command(regex: RegExp, acter: (match: RegExpMatchArray, parser: Parser) => string, type?: CommandType): void;
19
+ declare const _default: {
20
+ commands: CommandGroupType;
21
+ load_extensions: typeof load_extensions;
22
+ };
23
+ export default _default;
@@ -0,0 +1,303 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __read = (this && this.__read) || function (o, n) {
26
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27
+ if (!m) return o;
28
+ var i = m.call(o), r, ar = [], e;
29
+ try {
30
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
31
+ }
32
+ catch (error) { e = { error: error }; }
33
+ finally {
34
+ try {
35
+ if (r && !r.done && (m = i["return"])) m.call(i);
36
+ }
37
+ finally { if (e) throw e.error; }
38
+ }
39
+ return ar;
40
+ };
41
+ var __values = (this && this.__values) || function(o) {
42
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
43
+ if (m) return m.call(o);
44
+ if (o && typeof o.length === "number") return {
45
+ next: function () {
46
+ if (o && i >= o.length) o = void 0;
47
+ return { value: o && o[i++], done: !o };
48
+ }
49
+ };
50
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
51
+ };
52
+ var __importDefault = (this && this.__importDefault) || function (mod) {
53
+ return (mod && mod.__esModule) ? mod : { "default": mod };
54
+ };
55
+ Object.defineProperty(exports, "__esModule", { value: true });
56
+ exports.new_command = exports.load_extensions = exports.Command = exports.commands = void 0;
57
+ var path = __importStar(require("path"));
58
+ var fs = __importStar(require("fs"));
59
+ var templates_1 = __importStar(require("./templates"));
60
+ var require_runtime_1 = __importDefault(require("require-runtime"));
61
+ var nodeHtmlParser = __importStar(require("node-html-parser"));
62
+ var crypto_1 = __importDefault(require("crypto"));
63
+ var types_1 = require("./types");
64
+ var errors_1 = require("./errors");
65
+ var salt = crypto_1.default.randomBytes(2).toString("hex");
66
+ exports.commands = {
67
+ preparse: [],
68
+ parse: [],
69
+ postparse: [],
70
+ };
71
+ var Command = /** @class */ (function () {
72
+ function Command(validator, acter, type) {
73
+ validator = new RegExp(validator.source, validator.flags);
74
+ this.validator = validator;
75
+ this.acter = acter;
76
+ this.type = type;
77
+ /* add this function to appropriate file */
78
+ switch (type) {
79
+ case types_1.CommandType.PARSE:
80
+ exports.commands.parse.push(this);
81
+ break;
82
+ case types_1.CommandType.PREPARSE:
83
+ exports.commands.preparse.push(this);
84
+ break;
85
+ case types_1.CommandType.POSTPARSE:
86
+ exports.commands.postparse.push(this);
87
+ break;
88
+ }
89
+ }
90
+ Command.prototype.act = function (match, parser) {
91
+ return this.acter(match, parser);
92
+ };
93
+ return Command;
94
+ }());
95
+ exports.Command = Command;
96
+ /* variable shorthand */
97
+ new Command(/(\s|^)!<(.+)>/, function (match, parser) { return "".concat(match[1], "#mdvar<").concat(match[2], ">"); }, types_1.CommandType.PREPARSE);
98
+ /* mddef */
99
+ new Command(/#mddef< *(.+?) *= *(.+?) *>/ /* first .+ is lazy so as to not match following spaces */, function (match, parser) {
100
+ parser.opts.defs[match[1]] = match[2].replace("_", " ");
101
+ }, types_1.CommandType.PARSE);
102
+ /* mdvar */
103
+ new Command(/#mdvar<(.+?)>/, function (match, parser) {
104
+ var value = parser.opts.defs[match[1]];
105
+ if (!value && !parser.opts.allow_undefined)
106
+ throw new errors_1.MDMError("Undefined variable: ".concat(match[1]), match);
107
+ return (value = value || "<".concat(match[1], ">"));
108
+ }, types_1.CommandType.PARSE);
109
+ /** mdinclude */
110
+ new Command(/#mdinclude<([\w.\/-]+)(?:[,\s]+([\w]+))?>/, function (match, parser) {
111
+ /* increment the current recursion depth */
112
+ parser.opts.depth++;
113
+ if (parser.opts.depth > parser.opts.max_depth) {
114
+ throw new errors_1.MDMError("max depth exceeded!", match);
115
+ }
116
+ /* get the matching group */
117
+ var _a = __read(match, 3), _ = _a[0], name = _a[1], condition = _a[2];
118
+ /* implement conditional imports */
119
+ if (condition && !parser.opts.args.includes(condition))
120
+ return;
121
+ var fsstat = fs.lstatSync(path.join(parser.wd, name));
122
+ if (fsstat.isDirectory()) {
123
+ /* check if a file with the same name of the
124
+ * exists in the folder */
125
+ var entry = path.join(parser.wd, name, "".concat(name, ".md"));
126
+ if (fs.existsSync(entry)) {
127
+ name = path.join(name, "".concat(name, ".md"));
128
+ }
129
+ else {
130
+ throw new errors_1.MDMError("No entry file found in folder \"".concat(name, "\". Looking for \"").concat(entry, "\""), match);
131
+ }
132
+ }
133
+ var recursiveParser = parser.createChild(path.join(parser.wd, name));
134
+ /* keep the options the same */
135
+ recursiveParser.opts = parser.opts;
136
+ recursiveParser.parent = parser;
137
+ var fileType = path.extname(recursiveParser.file);
138
+ var blob = fileType === ".md"
139
+ ? recursiveParser.get(parser.opts.targetType)
140
+ : recursiveParser.raw;
141
+ parser.opts.depth--;
142
+ return blob;
143
+ }, types_1.CommandType.PARSE);
144
+ /* mdlabel */
145
+ new Command(/#mdlabel<(\d+),\s?(.+)>/, function (match, parser) {
146
+ if (parser.opts.targetType !== types_1.TargetType.HTML)
147
+ return "";
148
+ var level = Number.parseInt(match[1]);
149
+ var title = match[2];
150
+ var link = parser.titleId(title);
151
+ parser.opts.secs.push({ level: level, title: title });
152
+ return "<span id=\"".concat(link, "\"></span>");
153
+ }, types_1.CommandType.PREPARSE);
154
+ /* mdref */
155
+ new Command(/#mdref<(.+)>/, function (match, parser) {
156
+ for (var i = 0; i < parser.opts.secs.length; i++) {
157
+ var title = parser.opts.secs[i].title;
158
+ if (title === match[1])
159
+ break;
160
+ if (i === parser.opts.secs.length - 1)
161
+ throw new errors_1.MDMError("Reference to [".concat(match[1], "] could not be resolved!"), match);
162
+ }
163
+ match[1] = match[1].replace("_", " ");
164
+ var link = parser.titleId(match[1]);
165
+ if (parser.opts.targetType === types_1.TargetType.HTML)
166
+ return "<a href=\"#".concat(link, "\">").concat(match[1], "</a>");
167
+ else if (parser.opts.targetType === types_1.TargetType.MARKDOWN)
168
+ return "[".concat(match[1], "](#").concat(link, ")");
169
+ }, types_1.CommandType.PARSE);
170
+ /* mdtemplate */
171
+ new Command(/#mdtemplate<(\w+?)>/, function (match, parser) {
172
+ var template = match[1];
173
+ var replacement = templates_1.default[template];
174
+ if (replacement !== undefined) {
175
+ return replacement;
176
+ }
177
+ else {
178
+ throw new errors_1.MDMError("Template \"".concat(template, "\" not found!"), match);
179
+ }
180
+ }, types_1.CommandType.PARSE);
181
+ /* mdmaketoc */
182
+ new Command(/#mdmaketoc(?:<>)?/, function (match, parser) { return parser.get_toc(); }, types_1.CommandType.POSTPARSE);
183
+ /* mdadvhook */
184
+ new Command(/\#mdhook<(\w+)>([\w\W]+)\#mdendhook<\1>/m, function (match, parser) {
185
+ var e_1, _a, e_2, _b, e_3, _c;
186
+ if (!parser.opts.hooks[match[1]])
187
+ throw new errors_1.MDMError("No advanced hook found for ".concat(match[1]), match);
188
+ var innerElements = match[2].trim();
189
+ /* Run the inner elements through the parser itself */
190
+ var innerParser = parser.createChild(innerElements);
191
+ /* parse the inner */
192
+ var innerBlob = innerParser.get(parser.opts.targetType).trim();
193
+ /* Find all tagged elements in inner */
194
+ /* and construct helper map */
195
+ var re = /<(\w+)::(\w+)([\s=\w\"\'-]*)>/g;
196
+ var map = {};
197
+ try {
198
+ for (var _d = __values(innerBlob.matchAll(re)), _e = _d.next(); !_e.done; _e = _d.next()) {
199
+ var match_1 = _e.value;
200
+ var args = Array.from(match_1[3].matchAll(/(\w+)=["'](.+?)["']/g));
201
+ var argsMap = Object.fromEntries(args.map(function (x) { return x.slice(1); }));
202
+ map[match_1[2]] = {
203
+ "html-tag": match_1[1],
204
+ "var-tag": match_1[2],
205
+ node: new nodeHtmlParser.HTMLElement(match_1[1], {}),
206
+ args: Object.fromEntries(match_1[3]
207
+ .trim()
208
+ .split(" ")
209
+ .map(function (x) { return x.split("="); })),
210
+ _raw: match_1[0],
211
+ };
212
+ }
213
+ }
214
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
215
+ finally {
216
+ try {
217
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
218
+ }
219
+ finally { if (e_1) throw e_1.error; }
220
+ }
221
+ try {
222
+ /* Replace tagged elements in inner blob with their uuids */
223
+ for (var _f = __values(Object.values(map)), _g = _f.next(); !_g.done; _g = _f.next()) {
224
+ var taggedElement = _g.value;
225
+ innerBlob = innerBlob.replace(taggedElement._raw, salt + taggedElement["var-tag"] + salt);
226
+ }
227
+ }
228
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
229
+ finally {
230
+ try {
231
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
232
+ }
233
+ finally { if (e_2) throw e_2.error; }
234
+ }
235
+ /* Run the hook on the map*/
236
+ parser.opts.hooks[match[1]](map);
237
+ /* Replace the tagged elements with the modified nodes */
238
+ var output = innerBlob;
239
+ try {
240
+ for (var _h = __values(Object.values(map)), _j = _h.next(); !_j.done; _j = _h.next()) {
241
+ var taggedElement = _j.value;
242
+ output = output.replace(salt + taggedElement["var-tag"] + salt, taggedElement.node.toString());
243
+ }
244
+ }
245
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
246
+ finally {
247
+ try {
248
+ if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
249
+ }
250
+ finally { if (e_3) throw e_3.error; }
251
+ }
252
+ return output;
253
+ }, types_1.CommandType.POSTPARSE);
254
+ new Command(/<(\w+)([\#\.\w]+)\n([\w\W]*?)>/, function (match, _) {
255
+ var tag = match[1];
256
+ var tagline = match[2];
257
+ var id = tagline.match(/#(\w+)/)
258
+ ? "id=\"".concat(tagline.match(/#(\w+)/)[1], "\"")
259
+ : "";
260
+ var cls = tagline.match(/\.(.+)/);
261
+ var cls_str = "";
262
+ if (cls) {
263
+ cls_str =
264
+ cls.length > 1 ? "class=\"".concat(cls[1].replace(".", " "), "\"") : "";
265
+ }
266
+ var content = match[3];
267
+ return "<".concat(tag, " ").concat(id, " ").concat(cls_str, ">").concat(content.trim(), "</").concat(tag, ">");
268
+ }, types_1.CommandType.POSTPARSE);
269
+ var loaded_extentions = [];
270
+ function load_extension(parser, file) {
271
+ // if (loaded_extentions.includes(file)) return;
272
+ if (fs.existsSync(file)) {
273
+ var extensions = (0, require_runtime_1.default)(file);
274
+ loaded_extentions.push(file);
275
+ extensions.main(templates_1.new_template, new_command);
276
+ if (parser.opts.verbose)
277
+ console.log("Loaded extensions from ".concat(file).yellow);
278
+ }
279
+ else if (parser.opts.debug) {
280
+ console.log("No extensions found at ".concat(file).red);
281
+ }
282
+ }
283
+ function load_extensions(parser) {
284
+ /* global extention */
285
+ var global_extensions_path = path.join(__dirname, "extensions.js");
286
+ load_extension(parser, global_extensions_path);
287
+ /* project extention */
288
+ var project_extensions_path = path.join(parser.wd_full, "extensions.js");
289
+ load_extension(parser, project_extensions_path);
290
+ }
291
+ exports.load_extensions = load_extensions;
292
+ /**
293
+ *
294
+ * @param regex The regex to match the command
295
+ * @param acter The function called when a match is found. Takes two arguments, `match` and `parser`. `match` is the result of the regex match, and `parser` is the parser instance. The function should return the replacement string.
296
+ * @param type When the command should be run. Can be `CommandType.PREPARSE`, `CommandType.PARSE`, or `CommandType.POSTPARSE`. Defaults to `CommandType.PARSE`.
297
+ */
298
+ function new_command(regex, acter, type) {
299
+ new Command(regex, acter, type || types_1.CommandType.PARSE);
300
+ }
301
+ exports.new_command = new_command;
302
+ exports.default = { commands: exports.commands, load_extensions: load_extensions };
303
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA6B;AAE7B,qCAAyB;AACzB,uDAAsD;AACtD,oEAA6C;AAC7C,+DAAmD;AAEnD,kDAA4B;AAC5B,iCAKiB;AACjB,mCAAoC;AAEpC,IAAM,IAAI,GAAG,gBAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAEtC,QAAA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ACH,SAAgB,WAAW,CAC1B,KAAa,EACb,KAA0D,EAC1D,IAAkB;IAElB,IAAI,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,IAAI,mBAAW,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAND,kCAMC;AAED,kBAAe,EAAE,QAAQ,kBAAA,EAAE,eAAe,iBAAA,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare class MDMNonParserError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export declare class MDMError extends Error {
5
+ match: RegExpMatchArray;
6
+ constructor(message: string, match: RegExpMatchArray);
7
+ }
8
+ export declare class MDMWarning extends Error {
9
+ match?: RegExpMatchArray;
10
+ constructor(message: string, match?: RegExpMatchArray);
11
+ }