markdown-maker 1.10.2 → 1.10.4

Sign up to get free protection for your applications and to get access to all the features.
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,41 +0,0 @@
1
- const fs = require("fs");
2
- const assert = require("assert");
3
- const Parser = require("../bundle/parser");
4
- const path = require("path");
5
- const html = require("node-html-parser");
6
-
7
- /* make folder for temporary files, if it doesn't exist */
8
- if (
9
- !fs.existsSync("test/test-files") ||
10
- !fs.lstatSync("test/test-files").isDirectory()
11
- ) {
12
- fs.mkdirSync("test/test-files");
13
- }
14
-
15
- /**
16
- * Create a new file under `test/test-files` with the given content.
17
- * @param {string} text
18
- * @param {string} file
19
- */
20
- function put(text, file) {
21
- fs.writeFileSync(path.join("test", "test-files", file), text);
22
- }
23
- function putDir(name) {
24
- fs.mkdirSync(path.join("test", "test-files", name));
25
- }
26
-
27
- const TargetType = {
28
- HTML: 0,
29
- MARKDOWN: 1,
30
- };
31
-
32
- module.exports = {
33
- assert,
34
- fs,
35
- html,
36
- path,
37
- Parser,
38
- put,
39
- putDir,
40
- TargetType,
41
- };
package/test/vars.test.js DELETED
@@ -1,49 +0,0 @@
1
- const util = require("./tester.test.js");
2
-
3
- describe("Use variables", () => {
4
- it("should replace var with the value", () => {
5
- const output = new util.Parser("#mddef<hi=yo>\n#mdvar<hi>").get();
6
-
7
- util.assert.strictEqual(output, "\nyo\n\n");
8
- });
9
- it("should use variable shorthand", () => {
10
- const output = new util.Parser("#mddef<hi=yo>\n<hi>").get();
11
-
12
- util.assert.strictEqual(output, "\nyo\n\n");
13
- });
14
- it("should use variables across files", () => {
15
- util.put("#mddef<hi=yo>\n#mdinclude<sample2.md>", "sample1.md");
16
- util.put("<hi>", "sample2.md");
17
-
18
- const output = new util.Parser("test/test-files/sample1.md").get();
19
-
20
- util.assert.strictEqual(output, "\nyo\n\n");
21
- });
22
- it("should throw if undefined variable", () => {
23
- const parser = new util.Parser("<yo>");
24
-
25
- let e;
26
- /* should throw an error */
27
- util.assert.throws(() => {
28
- try {
29
- parser.get();
30
- } catch (_e) {
31
- e = _e;
32
- throw _e;
33
- }
34
- });
35
- });
36
-
37
- it("should preserve whatever comes after", () => {
38
- const output = new util.Parser("#mddef<hi=yo>\n<hi>,").get();
39
- util.assert.strictEqual(output, "\nyo,\n\n");
40
- });
41
-
42
- it("should replace underscore with space", () => {
43
- const output = new util.Parser(
44
- "#mddef<name=Mr_Sir>\n#mdvar<name>"
45
- ).get();
46
-
47
- util.assert.strictEqual(output, "\nMr Sir\n\n");
48
- });
49
- });