@honkit/markup-it 5.1.5 → 6.0.0

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 (132) hide show
  1. package/lib/markup.js +1 -0
  2. package/lib/parse/textToUnstyledTokens.d.ts +1 -1
  3. package/lib/parse/textToUnstyledTokens.d.ts.map +1 -1
  4. package/lib/utils/identity.js +1 -1
  5. package/package.json +10 -9
  6. package/lib/__tests__/syntax.d.ts +0 -2
  7. package/lib/__tests__/syntax.d.ts.map +0 -1
  8. package/lib/__tests__/syntax.js +0 -92
  9. package/lib/json/__tests__/decode.d.ts +0 -2
  10. package/lib/json/__tests__/decode.d.ts.map +0 -1
  11. package/lib/json/__tests__/decode.js +0 -38
  12. package/lib/json/__tests__/encode.d.ts +0 -2
  13. package/lib/json/__tests__/encode.d.ts.map +0 -1
  14. package/lib/json/__tests__/encode.js +0 -26
  15. package/lib/models/__tests__/token.d.ts +0 -2
  16. package/lib/models/__tests__/token.d.ts.map +0 -1
  17. package/lib/models/__tests__/token.js +0 -18
  18. package/lib/parse/__tests__/mergeTokens.d.ts +0 -2
  19. package/lib/parse/__tests__/mergeTokens.d.ts.map +0 -1
  20. package/lib/parse/__tests__/mergeTokens.js +0 -51
  21. package/syntaxes/markdown/__tests__/normalizeTeX.spec.js +0 -34
  22. package/syntaxes/markdown/__tests__/specs/amps_and_angles_encoding.html +0 -17
  23. package/syntaxes/markdown/__tests__/specs/amps_and_angles_encoding.md +0 -21
  24. package/syntaxes/markdown/__tests__/specs/auto_links.html +0 -18
  25. package/syntaxes/markdown/__tests__/specs/auto_links.md +0 -13
  26. package/syntaxes/markdown/__tests__/specs/autolink_lines.html +0 -3
  27. package/syntaxes/markdown/__tests__/specs/autolink_lines.md +0 -2
  28. package/syntaxes/markdown/__tests__/specs/backslash_escapes.html +0 -118
  29. package/syntaxes/markdown/__tests__/specs/backslash_escapes.md +0 -120
  30. package/syntaxes/markdown/__tests__/specs/blockquote_list_item.html +0 -3
  31. package/syntaxes/markdown/__tests__/specs/blockquote_list_item.md +0 -4
  32. package/syntaxes/markdown/__tests__/specs/blockquotes_with_code_blocks.html +0 -15
  33. package/syntaxes/markdown/__tests__/specs/blockquotes_with_code_blocks.md +0 -11
  34. package/syntaxes/markdown/__tests__/specs/case_insensitive_refs.html +0 -1
  35. package/syntaxes/markdown/__tests__/specs/case_insensitive_refs.md +0 -3
  36. package/syntaxes/markdown/__tests__/specs/code_blocks.html +0 -18
  37. package/syntaxes/markdown/__tests__/specs/code_blocks.md +0 -14
  38. package/syntaxes/markdown/__tests__/specs/code_blocks_indent.html +0 -13
  39. package/syntaxes/markdown/__tests__/specs/code_blocks_indent.md +0 -14
  40. package/syntaxes/markdown/__tests__/specs/code_spans.html +0 -6
  41. package/syntaxes/markdown/__tests__/specs/code_spans.md +0 -6
  42. package/syntaxes/markdown/__tests__/specs/def_blocks.html +0 -30
  43. package/syntaxes/markdown/__tests__/specs/def_blocks.md +0 -21
  44. package/syntaxes/markdown/__tests__/specs/double_link.html +0 -5
  45. package/syntaxes/markdown/__tests__/specs/double_link.md +0 -5
  46. package/syntaxes/markdown/__tests__/specs/escaped_angles.html +0 -1
  47. package/syntaxes/markdown/__tests__/specs/escaped_angles.md +0 -1
  48. package/syntaxes/markdown/__tests__/specs/footnotes.html +0 -4
  49. package/syntaxes/markdown/__tests__/specs/footnotes.md +0 -3
  50. package/syntaxes/markdown/__tests__/specs/gfm_break.breaks.html +0 -3
  51. package/syntaxes/markdown/__tests__/specs/gfm_break.breaks.md +0 -3
  52. package/syntaxes/markdown/__tests__/specs/gfm_code.html +0 -5
  53. package/syntaxes/markdown/__tests__/specs/gfm_code.md +0 -16
  54. package/syntaxes/markdown/__tests__/specs/gfm_code_hr_list.html +0 -52
  55. package/syntaxes/markdown/__tests__/specs/gfm_code_hr_list.md +0 -53
  56. package/syntaxes/markdown/__tests__/specs/gfm_del.html +0 -1
  57. package/syntaxes/markdown/__tests__/specs/gfm_del.md +0 -1
  58. package/syntaxes/markdown/__tests__/specs/gfm_em.html +0 -1
  59. package/syntaxes/markdown/__tests__/specs/gfm_em.md +0 -1
  60. package/syntaxes/markdown/__tests__/specs/gfm_links.html +0 -2
  61. package/syntaxes/markdown/__tests__/specs/gfm_links.md +0 -1
  62. package/syntaxes/markdown/__tests__/specs/gfm_tables.html +0 -37
  63. package/syntaxes/markdown/__tests__/specs/gfm_tables.md +0 -21
  64. package/syntaxes/markdown/__tests__/specs/hard_wrapped_paragraphs_with_list_like_lines.nogfm.html +0 -10
  65. package/syntaxes/markdown/__tests__/specs/hard_wrapped_paragraphs_with_list_like_lines.nogfm.md +0 -8
  66. package/syntaxes/markdown/__tests__/specs/horizontal_rules.html +0 -71
  67. package/syntaxes/markdown/__tests__/specs/horizontal_rules.md +0 -67
  68. package/syntaxes/markdown/__tests__/specs/hr_list_break.html +0 -10
  69. package/syntaxes/markdown/__tests__/specs/hr_list_break.md +0 -6
  70. package/syntaxes/markdown/__tests__/specs/image.html +0 -5
  71. package/syntaxes/markdown/__tests__/specs/image.md +0 -3
  72. package/syntaxes/markdown/__tests__/specs/inline_html.html +0 -6
  73. package/syntaxes/markdown/__tests__/specs/inline_html.md +0 -6
  74. package/syntaxes/markdown/__tests__/specs/inline_html_advanced.html +0 -15
  75. package/syntaxes/markdown/__tests__/specs/inline_html_advanced.md +0 -15
  76. package/syntaxes/markdown/__tests__/specs/inline_html_comments.html +0 -13
  77. package/syntaxes/markdown/__tests__/specs/inline_html_comments.md +0 -13
  78. package/syntaxes/markdown/__tests__/specs/inline_html_script.html +0 -3
  79. package/syntaxes/markdown/__tests__/specs/inline_html_script.md +0 -3
  80. package/syntaxes/markdown/__tests__/specs/inline_html_simple.html +0 -72
  81. package/syntaxes/markdown/__tests__/specs/inline_html_simple.md +0 -69
  82. package/syntaxes/markdown/__tests__/specs/lazy_blockquotes.html +0 -4
  83. package/syntaxes/markdown/__tests__/specs/lazy_blockquotes.md +0 -2
  84. package/syntaxes/markdown/__tests__/specs/links_inline_style.html +0 -15
  85. package/syntaxes/markdown/__tests__/specs/links_inline_style.md +0 -15
  86. package/syntaxes/markdown/__tests__/specs/links_reference_style.html +0 -52
  87. package/syntaxes/markdown/__tests__/specs/links_reference_style.md +0 -71
  88. package/syntaxes/markdown/__tests__/specs/links_shortcut_references.html +0 -9
  89. package/syntaxes/markdown/__tests__/specs/links_shortcut_references.md +0 -20
  90. package/syntaxes/markdown/__tests__/specs/list_item_text.html +0 -1
  91. package/syntaxes/markdown/__tests__/specs/list_item_text.md +0 -5
  92. package/syntaxes/markdown/__tests__/specs/literal_quotes_in_titles.html +0 -3
  93. package/syntaxes/markdown/__tests__/specs/literal_quotes_in_titles.md +0 -7
  94. package/syntaxes/markdown/__tests__/specs/loose_lists.html +0 -62
  95. package/syntaxes/markdown/__tests__/specs/loose_lists.md +0 -59
  96. package/syntaxes/markdown/__tests__/specs/main.html +0 -71
  97. package/syntaxes/markdown/__tests__/specs/main.md +0 -58
  98. package/syntaxes/markdown/__tests__/specs/markdown_documentation_basics.html +0 -314
  99. package/syntaxes/markdown/__tests__/specs/markdown_documentation_basics.md +0 -306
  100. package/syntaxes/markdown/__tests__/specs/markdown_documentation_syntax.html +0 -942
  101. package/syntaxes/markdown/__tests__/specs/markdown_documentation_syntax.md +0 -888
  102. package/syntaxes/markdown/__tests__/specs/nested_blockquotes.html +0 -9
  103. package/syntaxes/markdown/__tests__/specs/nested_blockquotes.md +0 -5
  104. package/syntaxes/markdown/__tests__/specs/nested_code.html +0 -1
  105. package/syntaxes/markdown/__tests__/specs/nested_code.md +0 -1
  106. package/syntaxes/markdown/__tests__/specs/nested_em.html +0 -3
  107. package/syntaxes/markdown/__tests__/specs/nested_em.md +0 -3
  108. package/syntaxes/markdown/__tests__/specs/nested_square_link.html +0 -1
  109. package/syntaxes/markdown/__tests__/specs/nested_square_link.md +0 -1
  110. package/syntaxes/markdown/__tests__/specs/not_a_link.html +0 -1
  111. package/syntaxes/markdown/__tests__/specs/not_a_link.md +0 -1
  112. package/syntaxes/markdown/__tests__/specs/ordered_and_unordered_lists.html +0 -148
  113. package/syntaxes/markdown/__tests__/specs/ordered_and_unordered_lists.md +0 -131
  114. package/syntaxes/markdown/__tests__/specs/ref_paren.html +0 -1
  115. package/syntaxes/markdown/__tests__/specs/ref_paren.md +0 -3
  116. package/syntaxes/markdown/__tests__/specs/same_bullet.html +0 -5
  117. package/syntaxes/markdown/__tests__/specs/same_bullet.md +0 -3
  118. package/syntaxes/markdown/__tests__/specs/simple_paragraph.html +0 -1
  119. package/syntaxes/markdown/__tests__/specs/simple_paragraph.md +0 -1
  120. package/syntaxes/markdown/__tests__/specs/strong_and_em_together.html +0 -7
  121. package/syntaxes/markdown/__tests__/specs/strong_and_em_together.md +0 -7
  122. package/syntaxes/markdown/__tests__/specs/table_pipe.html +0 -5
  123. package/syntaxes/markdown/__tests__/specs/table_pipe.md +0 -4
  124. package/syntaxes/markdown/__tests__/specs/tabs.html +0 -25
  125. package/syntaxes/markdown/__tests__/specs/tabs.md +0 -21
  126. package/syntaxes/markdown/__tests__/specs/tidyness.html +0 -8
  127. package/syntaxes/markdown/__tests__/specs/tidyness.md +0 -5
  128. package/syntaxes/markdown/__tests__/specs/toplevel_paragraphs.gfm.html +0 -34
  129. package/syntaxes/markdown/__tests__/specs/toplevel_paragraphs.gfm.md +0 -37
  130. package/syntaxes/markdown/__tests__/specs/tricky_list.html +0 -23
  131. package/syntaxes/markdown/__tests__/specs/tricky_list.md +0 -15
  132. package/syntaxes/markdown/__tests__/specs.js +0 -74
package/lib/markup.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const parse_1 = __importDefault(require("./parse"));
7
7
  const render_1 = __importDefault(require("./render"));
8
8
  class DraftMarkup {
9
+ syntax;
9
10
  /**
10
11
  * Create an instance using a set of rules
11
12
  * @param {Syntax} syntax
@@ -7,6 +7,6 @@ import Immutable from "immutable";
7
7
  * @param {string} text
8
8
  * @return {List<Token>}
9
9
  */
10
- declare function textToUnstyledTokens(state: any, isInline: any, text: any): Immutable.List<unknown>;
10
+ declare function textToUnstyledTokens(state: any, isInline: any, text: any): Immutable.List<any>;
11
11
  export default textToUnstyledTokens;
12
12
  //# sourceMappingURL=textToUnstyledTokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"textToUnstyledTokens.d.ts","sourceRoot":"","sources":["../../src/parse/textToUnstyledTokens.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAkBlC;;;;;;;GAOG;AACH,iBAAS,oBAAoB,CAAC,KAAK,KAAA,EAAE,QAAQ,KAAA,EAAE,IAAI,KAAA,2BAkClD;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"textToUnstyledTokens.d.ts","sourceRoot":"","sources":["../../src/parse/textToUnstyledTokens.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAkBlC;;;;;;;GAOG;AACH,iBAAS,oBAAoB,CAAC,KAAK,KAAA,EAAE,QAAQ,KAAA,EAAE,IAAI,KAAA,uBAkClD;AAED,eAAe,oBAAoB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = identity;
3
4
  function identity(value) {
4
5
  return value;
5
6
  }
6
- exports.default = identity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honkit/markup-it",
3
- "version": "5.1.5",
3
+ "version": "6.0.0",
4
4
  "description": "Pipeline for working with markup input (for example Markdown)",
5
5
  "keywords": [
6
6
  "draft-js",
@@ -33,24 +33,25 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "escape-string-regexp": "^4.0.0",
36
- "html-entities": "^1.3.1",
36
+ "html-entities": "^1.4.0",
37
37
  "htmlparser2": "^4.1.0",
38
- "immutable": "^3.7.6",
38
+ "immutable": "^3.8.2",
39
39
  "is": "^3.3.0",
40
40
  "object-values": "^2.0.0",
41
41
  "range-utils": "^1.1.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@types/jest": "^29.5.3",
45
- "eslint": "^8.23.1",
46
- "jest": "^29.0.3",
47
- "jsdom": "^20.0.0",
44
+ "@types/jest": "^29.5.13",
45
+ "@types/node": "^22.7.4",
46
+ "eslint": "^8.57.1",
47
+ "jest": "^29.7.0",
48
+ "jsdom": "^20.0.3",
48
49
  "rimraf": "^3.0.2",
49
50
  "should": "^13.2.3",
50
- "ts-jest": "^29.0.1"
51
+ "ts-jest": "^29.2.5"
51
52
  },
52
53
  "publishConfig": {
53
54
  "access": "public"
54
55
  },
55
- "gitHead": "d75ed67c85e3fc6976e837b56402f84e860886c7"
56
+ "gitHead": "367fe659a4a33c656ae51a1ec75fff0447365f9f"
56
57
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=syntax.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syntax.d.ts","sourceRoot":"","sources":["../../src/__tests__/syntax.ts"],"names":[],"mappings":""}
@@ -1,92 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
26
- // @ts-ignore
27
- const MarkupIt = __importStar(require(".."));
28
- describe("Custom Syntax", () => {
29
- const syntax = MarkupIt.Syntax("mysyntax", {
30
- inline: [
31
- MarkupIt.Rule(MarkupIt.STYLES.BOLD)
32
- .regExp(/^\*\*([\s\S]+?)\*\*/, (state, match) => {
33
- return {
34
- text: match[1],
35
- };
36
- })
37
- .toText("**%s**"),
38
- ],
39
- });
40
- const markup = new MarkupIt.Markup(syntax);
41
- describe(".toContent", () => {
42
- it("should return correct syntax name", () => {
43
- const content = markup.toContent("Hello");
44
- content.getSyntax().should.equal("mysyntax");
45
- });
46
- it("should parse as unstyled", () => {
47
- const content = markup.toContent("Hello World");
48
- const doc = content.getToken();
49
- const blocks = doc.getTokens();
50
- blocks.size.should.equal(1);
51
- const p = blocks.get(0);
52
- p.getType().should.equal(MarkupIt.BLOCKS.TEXT);
53
- p.getAsPlainText().should.equal("Hello World");
54
- });
55
- it("should parse inline", () => {
56
- const content = markup.toContent("Hello **World**");
57
- const doc = content.getToken();
58
- const blocks = doc.getTokens();
59
- blocks.size.should.equal(1);
60
- const p = blocks.get(0);
61
- p.getType().should.equal(MarkupIt.BLOCKS.TEXT);
62
- p.getAsPlainText().should.equal("Hello World");
63
- });
64
- });
65
- describe(".toText", () => {
66
- it("should output correct string", () => {
67
- const content = MarkupIt.JSONUtils.decode({
68
- syntax: "mysyntax",
69
- token: {
70
- type: MarkupIt.BLOCKS.DOCUMENT,
71
- tokens: [
72
- {
73
- type: MarkupIt.BLOCKS.PARAGRAPH,
74
- tokens: [
75
- {
76
- type: MarkupIt.STYLES.TEXT,
77
- text: "Hello ",
78
- },
79
- {
80
- type: MarkupIt.STYLES.BOLD,
81
- text: "World",
82
- },
83
- ],
84
- },
85
- ],
86
- },
87
- });
88
- const text = markup.toText(content);
89
- text.should.equal("Hello **World**\n");
90
- });
91
- });
92
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=decode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/json/__tests__/decode.ts"],"names":[],"mappings":""}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const decode_1 = __importDefault(require("../decode"));
7
- const blocks_1 = __importDefault(require("../../constants/blocks"));
8
- describe("decode", () => {
9
- let content;
10
- beforeAll(() => {
11
- content = (0, decode_1.default)({
12
- syntax: "mysyntax",
13
- token: {
14
- type: blocks_1.default.DOCUMENT,
15
- tokens: [
16
- {
17
- type: blocks_1.default.PARAGRAPH,
18
- text: "Hello World",
19
- raw: "Hello World",
20
- },
21
- ],
22
- },
23
- });
24
- });
25
- it("should decode syntax name", () => {
26
- content.getSyntax().should.equal("mysyntax");
27
- });
28
- it("should decode tokens tree", () => {
29
- const doc = content.getToken();
30
- const tokens = doc.getTokens();
31
- tokens.size.should.equal(1);
32
- const p = tokens.get(0);
33
- p.getType().should.equal(blocks_1.default.PARAGRAPH);
34
- p.getText().should.equal("Hello World");
35
- p.getRaw().should.equal("Hello World");
36
- p.getTokens().size.should.equal(0);
37
- });
38
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=encode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/json/__tests__/encode.ts"],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const encode_1 = __importDefault(require("../encode"));
7
- const blocks_1 = __importDefault(require("../../constants/blocks"));
8
- describe("encode", () => {
9
- let json;
10
- beforeAll(() => {
11
- // @ts-expect-error
12
- json = (0, encode_1.default)(mock.paragraph);
13
- });
14
- it("should encode syntax name", () => {
15
- json.syntax.should.equal("mysyntax");
16
- });
17
- it("should encode tokens", () => {
18
- json.should.have.property("token");
19
- const doc = json.token;
20
- doc.tokens.should.have.lengthOf(1);
21
- const p = doc.tokens[0];
22
- p.type.should.equal(blocks_1.default.PARAGRAPH);
23
- p.text.should.equal("Hello World");
24
- p.tokens.should.be.an.Array().with.lengthOf(2);
25
- });
26
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=token.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/token.ts"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const token_1 = __importDefault(require("../token"));
7
- const styles_1 = __importDefault(require("../../constants/styles"));
8
- describe("Token", () => {
9
- describe(".mergeWith", () => {
10
- it("should merge text and raw", () => {
11
- const base = token_1.default.createText("Hello ");
12
- const other = token_1.default.createText("world");
13
- const token = base.mergeWith(other);
14
- token.getType().should.equal(styles_1.default.TEXT);
15
- token.getText().should.equal("Hello world");
16
- });
17
- });
18
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=mergeTokens.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeTokens.d.ts","sourceRoot":"","sources":["../../../src/parse/__tests__/mergeTokens.ts"],"names":[],"mappings":""}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const immutable_1 = __importDefault(require("immutable"));
7
- const token_1 = __importDefault(require("../../models/token"));
8
- const styles_1 = __importDefault(require("../../constants/styles"));
9
- const mergeTokens_1 = __importDefault(require("../mergeTokens"));
10
- describe("mergeTokens", () => {
11
- it("should merge two tokens", () => {
12
- const tokens = immutable_1.default.List([token_1.default.createText("Hello "), token_1.default.createText("world")]);
13
- const merged = (0, mergeTokens_1.default)(tokens, [styles_1.default.TEXT]);
14
- merged.size.should.equal(1);
15
- const resultToken = merged.get(0);
16
- resultToken.getType().should.equal(styles_1.default.TEXT);
17
- resultToken.getText().should.equal("Hello world");
18
- });
19
- it("should merge three tokens", () => {
20
- const tokens = immutable_1.default.List([token_1.default.createText("Hello "), token_1.default.createText("world"), token_1.default.createText("!")]);
21
- const merged = (0, mergeTokens_1.default)(tokens, [styles_1.default.TEXT]);
22
- merged.size.should.equal(1);
23
- const resultToken = merged.get(0);
24
- resultToken.getType().should.equal(styles_1.default.TEXT);
25
- resultToken.getText().should.equal("Hello world!");
26
- });
27
- it("should merge 2x2 tokens", () => {
28
- const tokens = immutable_1.default.List([
29
- token_1.default.createText("Hello "),
30
- token_1.default.createText("world"),
31
- // @ts-ignore
32
- new token_1.default({
33
- type: styles_1.default.BOLD,
34
- text: ", right?",
35
- }),
36
- token_1.default.createText("!"),
37
- token_1.default.createText("!"),
38
- ]);
39
- const merged = (0, mergeTokens_1.default)(tokens, [styles_1.default.TEXT]);
40
- merged.size.should.equal(3);
41
- const first = merged.get(0);
42
- const bold = merged.get(1);
43
- const second = merged.get(2);
44
- first.getType().should.equal(styles_1.default.TEXT);
45
- first.getText().should.equal("Hello world");
46
- bold.getType().should.equal(styles_1.default.BOLD);
47
- bold.getText().should.equal(", right?");
48
- second.getType().should.equal(styles_1.default.TEXT);
49
- second.getText().should.equal("!!");
50
- });
51
- });
@@ -1,34 +0,0 @@
1
- const { normalizeTeX } = require("../math.js");
2
-
3
- describe("normalizeTeX", () => {
4
- it(`should normalize`, () => {
5
- expect(normalizeTeX("$a$", true)).toMatchInlineSnapshot(`"$a$"`);
6
- expect(normalizeTeX("$$a$$", true)).toMatchInlineSnapshot(`"$$a$$"`);
7
- expect(normalizeTeX("$a$ $b$", true)).toMatchInlineSnapshot(`"$a$ $b$"`);
8
- expect(normalizeTeX("$a$ $b$ $c$", true)).toMatchInlineSnapshot(`"$a$ $b$ $c$"`);
9
- expect(normalizeTeX("$a$\n$b$", true)).toMatchInlineSnapshot(`
10
- "$a$
11
- $b$"
12
- `);
13
- expect(normalizeTeX("$a$\n\n$b$", true)).toMatchInlineSnapshot(`
14
- "$a$
15
-
16
- $b$"
17
- `);
18
- expect(normalizeTeX("$a$ $b$\n", true)).toMatchInlineSnapshot(`"$a$ $b$"`);
19
- expect(normalizeTeX("$a$ $b$\n\n", true)).toMatchInlineSnapshot(`"$a$ $b$"`);
20
- expect(normalizeTeX("$a$\n$b$\n", true)).toMatchInlineSnapshot(`
21
- "$a$
22
- $b$"
23
- `);
24
- expect(normalizeTeX("$a$\n\n$b$\n\n", true)).toMatchInlineSnapshot(`
25
- "$a$
26
-
27
- $b$"
28
- `);
29
- expect(normalizeTeX("$a$ $b$", true)).toMatchInlineSnapshot(`"$a$ $b$"`);
30
- expect(normalizeTeX("$a$ $b$", true)).toMatchInlineSnapshot(`"$a$ $b$"`);
31
- expect(normalizeTeX("$a$ $b$ $c$", true)).toMatchInlineSnapshot(`"$a$ $b$ $c$"`);
32
- expect(normalizeTeX("$a$ $b$ $c$", true)).toMatchInlineSnapshot(`"$a$ $b$ $c$"`);
33
- });
34
- });
@@ -1,17 +0,0 @@
1
- <p>AT&amp;T has an ampersand in their name.</p>
2
-
3
- <p>AT&amp;T is another way to write it.</p>
4
-
5
- <p>This &amp; that.</p>
6
-
7
- <p>4 &lt; 5.</p>
8
-
9
- <p>6 &gt; 5.</p>
10
-
11
- <p>Here&apos;s a <a href="http://example.com/?foo=1&amp;bar=2">link</a> with an ampersand in the URL.</p>
12
-
13
- <p>Here&apos;s a link with an amersand in the link text: <a href="http://att.com/" title="AT&amp;T">AT&amp;T</a>.</p>
14
-
15
- <p>Here&apos;s an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
16
-
17
- <p>Here&apos;s an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
@@ -1,21 +0,0 @@
1
- AT&T has an ampersand in their name.
2
-
3
- AT&amp;T is another way to write it.
4
-
5
- This & that.
6
-
7
- 4 < 5.
8
-
9
- 6 > 5.
10
-
11
- Here's a [link] [1] with an ampersand in the URL.
12
-
13
- Here's a link with an amersand in the link text: [AT&T] [2].
14
-
15
- Here's an inline [link](/script?foo=1&bar=2).
16
-
17
- Here's an inline [link](</script?foo=1&bar=2>).
18
-
19
-
20
- [1]: http://example.com/?foo=1&bar=2
21
- [2]: http://att.com/ "AT&T"
@@ -1,18 +0,0 @@
1
- <p>Link: <a href="http://example.com/">http://example.com/</a>.</p>
2
-
3
- <p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
4
-
5
- <ul>
6
- <li>In a list?</li>
7
- <li><a href="http://example.com/">http://example.com/</a></li>
8
- <li>It should.</li>
9
- </ul>
10
-
11
- <blockquote>
12
- <p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
13
- </blockquote>
14
-
15
- <p>Auto-links should not occur here: <code>&lt;http://example.com/&gt;</code></p>
16
-
17
- <pre><code>or here: &lt;http://example.com/&gt;
18
- </code></pre>
@@ -1,13 +0,0 @@
1
- Link: <http://example.com/>.
2
-
3
- With an ampersand: <http://example.com/?foo=1&bar=2>
4
-
5
- * In a list?
6
- * <http://example.com/>
7
- * It should.
8
-
9
- > Blockquoted: <http://example.com/>
10
-
11
- Auto-links should not occur here: `<http://example.com/>`
12
-
13
- or here: <http://example.com/>
@@ -1,3 +0,0 @@
1
- <p>hello world
2
- <a href="http://example.com">http://example.com</a>
3
- </p>
@@ -1,2 +0,0 @@
1
- hello world
2
- <http://example.com>
@@ -1,118 +0,0 @@
1
- <p>These should all get escaped:</p>
2
-
3
- <p>Backslash: \</p>
4
-
5
- <p>Backtick: `</p>
6
-
7
- <p>Asterisk: *</p>
8
-
9
- <p>Underscore: _</p>
10
-
11
- <p>Left brace: {</p>
12
-
13
- <p>Right brace: }</p>
14
-
15
- <p>Left bracket: [</p>
16
-
17
- <p>Right bracket: ]</p>
18
-
19
- <p>Left paren: (</p>
20
-
21
- <p>Right paren: )</p>
22
-
23
- <p>Greater-than: ></p>
24
-
25
- <p>Hash: #</p>
26
-
27
- <p>Period: .</p>
28
-
29
- <p>Bang: !</p>
30
-
31
- <p>Plus: +</p>
32
-
33
- <p>Minus: -</p>
34
-
35
- <p>These should not, because they occur within a code block:</p>
36
-
37
- <pre><code>Backslash: \\
38
-
39
- Backtick: \`
40
-
41
- Asterisk: \*
42
-
43
- Underscore: \_
44
-
45
- Left brace: \{
46
-
47
- Right brace: \}
48
-
49
- Left bracket: \[
50
-
51
- Right bracket: \]
52
-
53
- Left paren: \(
54
-
55
- Right paren: \)
56
-
57
- Greater-than: \&gt;
58
-
59
- Hash: \#
60
-
61
- Period: \.
62
-
63
- Bang: \!
64
-
65
- Plus: \+
66
-
67
- Minus: \-
68
- </code></pre>
69
-
70
- <p>Nor should these, which occur in code spans:</p>
71
-
72
- <p>Backslash: <code>\\</code></p>
73
-
74
- <p>Backtick: <code>\`</code></p>
75
-
76
- <p>Asterisk: <code>\*</code></p>
77
-
78
- <p>Underscore: <code>\_</code></p>
79
-
80
- <p>Left brace: <code>\{</code></p>
81
-
82
- <p>Right brace: <code>\}</code></p>
83
-
84
- <p>Left bracket: <code>\[</code></p>
85
-
86
- <p>Right bracket: <code>\]</code></p>
87
-
88
- <p>Left paren: <code>\(</code></p>
89
-
90
- <p>Right paren: <code>\)</code></p>
91
-
92
- <p>Greater-than: <code>\&gt;</code></p>
93
-
94
- <p>Hash: <code>\#</code></p>
95
-
96
- <p>Period: <code>\.</code></p>
97
-
98
- <p>Bang: <code>\!</code></p>
99
-
100
- <p>Plus: <code>\+</code></p>
101
-
102
- <p>Minus: <code>\-</code></p>
103
-
104
-
105
- <p>These should get escaped, even though they&apos;re matching pairs for
106
- other Markdown constructs:</p>
107
-
108
- <p>*asterisks*</p>
109
-
110
- <p>_underscores_</p>
111
-
112
- <p>`backticks`</p>
113
-
114
- <p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>
115
-
116
- <p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>
117
-
118
- <p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>