diff --git a/tools/challenge-parser/parser/__fixtures__/ast-adjacent-keys.json b/tools/challenge-parser/parser/__fixtures__/ast-adjacent-keys.json deleted file mode 100644 index ebb3e6e5d25..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-adjacent-keys.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 5, "column": 1, "offset": 34 }, - "end": { "line": 10, "column": 4, "offset": 79 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 12, "column": 1, "offset": 81 }, - "end": { "line": 16, "column": 4, "offset": 121 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "key-for-css" }, - "children": [], - "position": { - "start": { "line": 18, "column": 1, "offset": 123 }, - "end": { "line": 18, "column": 19, "offset": 141 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "key-for-js" }, - "children": [], - "position": { - "start": { "line": 20, "column": 1, "offset": 143 }, - "end": { "line": 20, "column": 18, "offset": 160 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 22, "column": 1, "offset": 162 }, - "end": { "line": 24, "column": 4, "offset": 184 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 25, "column": 1, "offset": 185 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-before-after.json b/tools/challenge-parser/parser/__fixtures__/ast-before-after.json deleted file mode 100644 index e4648803d5b..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-before-after.json +++ /dev/null @@ -1,617 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 7, "column": 4, "offset": 56 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 9, "column": 3, "offset": 60 }, - "end": { "line": 9, "column": 19, "offset": 76 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 58 }, - "end": { "line": 9, "column": 19, "offset": 76 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 91 }, - "end": { "line": 15, "column": 4, "offset": 117 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 17, "column": 3, "offset": 121 }, - "end": { "line": 17, "column": 12, "offset": 130 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 17, "column": 1, "offset": 119 }, - "end": { "line": 17, "column": 12, "offset": 130 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-1", - "label": "test-id-1", - "referenceType": "shortcut", - "alt": "test-id-1", - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 13, "offset": 144 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 13, "offset": 144 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 21, "column": 1, "offset": 146 }, - "end": { "line": 21, "column": 11, "offset": 156 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 21, "column": 1, "offset": 146 }, - "end": { "line": 21, "column": 11, "offset": 156 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 23, "column": 1, "offset": 158 }, - "end": { "line": 25, "column": 4, "offset": 180 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-2", - "label": "test-id-2", - "referenceType": "shortcut", - "alt": "test-id-2", - "position": { - "start": { "line": 27, "column": 1, "offset": 182 }, - "end": { "line": 27, "column": 13, "offset": 194 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 27, "column": 1, "offset": 182 }, - "end": { "line": 27, "column": 13, "offset": 194 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 29, "column": 1, "offset": 196 }, - "end": { "line": 29, "column": 18, "offset": 213 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 29, "column": 18, "offset": 213 }, - "end": { "line": 29, "column": 24, "offset": 219 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 29, "column": 24, "offset": 219 }, - "end": { "line": 29, "column": 28, "offset": 223 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 29, "column": 28, "offset": 223 }, - "end": { "line": 29, "column": 35, "offset": 230 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 29, "column": 1, "offset": 196 }, - "end": { "line": 29, "column": 35, "offset": 230 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 31, "column": 1, "offset": 232 }, - "end": { "line": 33, "column": 4, "offset": 259 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-3", - "label": "test-id-3", - "referenceType": "shortcut", - "alt": "test-id-3", - "position": { - "start": { "line": 35, "column": 1, "offset": 261 }, - "end": { "line": 35, "column": 13, "offset": 273 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 261 }, - "end": { "line": 35, "column": 13, "offset": 273 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Third ", - "position": { - "start": { "line": 37, "column": 1, "offset": 275 }, - "end": { "line": 37, "column": 7, "offset": 281 }, - "indent": [] - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "hint", - "position": { - "start": { "line": 37, "column": 8, "offset": 282 }, - "end": { "line": 37, "column": 12, "offset": 286 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 7, "offset": 281 }, - "end": { "line": 37, "column": 13, "offset": 287 }, - "indent": [] - } - }, - { - "type": "text", - "value": " with ", - "position": { - "start": { "line": 37, "column": 13, "offset": 287 }, - "end": { "line": 37, "column": 19, "offset": 293 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 37, "column": 19, "offset": 293 }, - "end": { "line": 37, "column": 25, "offset": 299 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 37, "column": 25, "offset": 299 }, - "end": { "line": 37, "column": 29, "offset": 303 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 37, "column": 29, "offset": 303 }, - "end": { "line": 37, "column": 36, "offset": 310 }, - "indent": [] - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 37, "column": 36, "offset": 310 }, - "end": { "line": 37, "column": 41, "offset": 315 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "inline code", - "position": { - "start": { "line": 37, "column": 41, "offset": 315 }, - "end": { "line": 37, "column": 54, "offset": 328 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 1, "offset": 275 }, - "end": { "line": 37, "column": 54, "offset": 328 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code\nif(let x of xs) {\n console.log(x);\n}", - "position": { - "start": { "line": 39, "column": 1, "offset": 330 }, - "end": { "line": 44, "column": 4, "offset": 395 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 46, "column": 3, "offset": 399 }, - "end": { "line": 46, "column": 11, "offset": 407 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 46, "column": 1, "offset": 397 }, - "end": { "line": 46, "column": 11, "offset": 407 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 48, "column": 4, "offset": 412 }, - "end": { "line": 48, "column": 24, "offset": 432 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 48, "column": 1, "offset": 409 }, - "end": { "line": 48, "column": 24, "offset": 432 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n etc: ''\n}", - "position": { - "start": { "line": 50, "column": 1, "offset": 434 }, - "end": { "line": 54, "column": 4, "offset": 463 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "", - "position": { - "start": { "line": 56, "column": 1, "offset": 465 }, - "end": { "line": 58, "column": 4, "offset": 493 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 60, "column": 4, "offset": 498 }, - "end": { "line": 60, "column": 21, "offset": 515 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 60, "column": 1, "offset": 495 }, - "end": { "line": 60, "column": 21, "offset": 515 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 62, "column": 1, "offset": 517 }, - "end": { "line": 67, "column": 4, "offset": 562 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 69, "column": 1, "offset": 564 }, - "end": { "line": 73, "column": 4, "offset": 604 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 75, "column": 1, "offset": 606 }, - "end": { "line": 77, "column": 4, "offset": 628 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--after-user-code--", - "position": { - "start": { "line": 79, "column": 4, "offset": 633 }, - "end": { "line": 79, "column": 23, "offset": 652 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 79, "column": 1, "offset": 630 }, - "end": { "line": 79, "column": 23, "offset": 652 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: blue;\n}", - "position": { - "start": { "line": 81, "column": 1, "offset": 654 }, - "end": { "line": 85, "column": 4, "offset": 693 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "function teardown(params) {\n // after\n}", - "position": { - "start": { "line": 87, "column": 1, "offset": 695 }, - "end": { "line": 91, "column": 4, "offset": 745 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 94, "column": 3, "offset": 750 }, - "end": { "line": 94, "column": 15, "offset": 762 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 94, "column": 1, "offset": 748 }, - "end": { "line": 94, "column": 15, "offset": 762 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 96, "column": 1, "offset": 764 }, - "end": { "line": 96, "column": 12, "offset": 775 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 96, "column": 1, "offset": 764 }, - "end": { "line": 96, "column": 12, "offset": 775 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 98, "column": 1, "offset": 777 }, - "end": { "line": 103, "column": 4, "offset": 822 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 105, "column": 1, "offset": 824 }, - "end": { "line": 109, "column": 4, "offset": 864 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';\n``\n", - "position": { - "start": { "line": 111, "column": 1, "offset": 866 }, - "end": { "line": 114, "column": 1, "offset": 888 }, - "indent": [1, 1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 114, "column": 1, "offset": 888 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-broken-hints.json b/tools/challenge-parser/parser/__fixtures__/ast-broken-hints.json deleted file mode 100644 index 2175e6185b2..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-broken-hints.json +++ /dev/null @@ -1,502 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 7, "column": 4, "offset": 56 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 9, "column": 3, "offset": 60 }, - "end": { "line": 9, "column": 19, "offset": 76 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 58 }, - "end": { "line": 9, "column": 19, "offset": 76 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 91 }, - "end": { "line": 15, "column": 4, "offset": 117 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 17, "column": 3, "offset": 121 }, - "end": { "line": 17, "column": 12, "offset": 130 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 17, "column": 1, "offset": 119 }, - "end": { "line": 17, "column": 12, "offset": 130 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-1", - "label": "test-id-1", - "referenceType": "shortcut", - "alt": "test-id-1", - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 13, "offset": 144 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 13, "offset": 144 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 21, "column": 1, "offset": 146 }, - "end": { "line": 23, "column": 4, "offset": 168 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 25, "column": 1, "offset": 170 }, - "end": { "line": 25, "column": 11, "offset": 180 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 25, "column": 1, "offset": 170 }, - "end": { "line": 25, "column": 11, "offset": 180 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 27, "column": 1, "offset": 182 }, - "end": { "line": 27, "column": 18, "offset": 199 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 27, "column": 18, "offset": 199 }, - "end": { "line": 27, "column": 24, "offset": 205 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 27, "column": 24, "offset": 205 }, - "end": { "line": 27, "column": 28, "offset": 209 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 27, "column": 28, "offset": 209 }, - "end": { "line": 27, "column": 35, "offset": 216 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 27, "column": 1, "offset": 182 }, - "end": { "line": 27, "column": 35, "offset": 216 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-2", - "label": "test-id-2", - "referenceType": "shortcut", - "alt": "test-id-2", - "position": { - "start": { "line": 29, "column": 1, "offset": 218 }, - "end": { "line": 29, "column": 13, "offset": 230 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 29, "column": 1, "offset": 218 }, - "end": { "line": 29, "column": 13, "offset": 230 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 31, "column": 1, "offset": 232 }, - "end": { "line": 33, "column": 4, "offset": 259 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-3", - "label": "test-id-3", - "referenceType": "shortcut", - "alt": "test-id-3", - "position": { - "start": { "line": 35, "column": 1, "offset": 261 }, - "end": { "line": 35, "column": 13, "offset": 273 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 261 }, - "end": { "line": 35, "column": 13, "offset": 273 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Third ", - "position": { - "start": { "line": 37, "column": 1, "offset": 275 }, - "end": { "line": 37, "column": 7, "offset": 281 }, - "indent": [] - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "hint", - "position": { - "start": { "line": 37, "column": 8, "offset": 282 }, - "end": { "line": 37, "column": 12, "offset": 286 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 7, "offset": 281 }, - "end": { "line": 37, "column": 13, "offset": 287 }, - "indent": [] - } - }, - { - "type": "text", - "value": " with ", - "position": { - "start": { "line": 37, "column": 13, "offset": 287 }, - "end": { "line": 37, "column": 19, "offset": 293 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 37, "column": 19, "offset": 293 }, - "end": { "line": 37, "column": 25, "offset": 299 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 37, "column": 25, "offset": 299 }, - "end": { "line": 37, "column": 29, "offset": 303 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 37, "column": 29, "offset": 303 }, - "end": { "line": 37, "column": 36, "offset": 310 }, - "indent": [] - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 37, "column": 36, "offset": 310 }, - "end": { "line": 37, "column": 41, "offset": 315 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "inline code", - "position": { - "start": { "line": 37, "column": 41, "offset": 315 }, - "end": { "line": 37, "column": 54, "offset": 328 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 1, "offset": 275 }, - "end": { "line": 37, "column": 54, "offset": 328 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 40, "column": 3, "offset": 333 }, - "end": { "line": 40, "column": 11, "offset": 341 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 40, "column": 1, "offset": 331 }, - "end": { "line": 40, "column": 11, "offset": 341 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 42, "column": 1, "offset": 343 }, - "end": { "line": 47, "column": 4, "offset": 388 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 49, "column": 1, "offset": 390 }, - "end": { "line": 53, "column": 4, "offset": 430 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 55, "column": 1, "offset": 432 }, - "end": { "line": 57, "column": 4, "offset": 454 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 60, "column": 3, "offset": 459 }, - "end": { "line": 60, "column": 15, "offset": 471 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 60, "column": 1, "offset": 457 }, - "end": { "line": 60, "column": 15, "offset": 471 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 62, "column": 1, "offset": 473 }, - "end": { "line": 62, "column": 12, "offset": 484 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 62, "column": 1, "offset": 473 }, - "end": { "line": 62, "column": 12, "offset": 484 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 64, "column": 1, "offset": 486 }, - "end": { "line": 69, "column": 4, "offset": 531 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 71, "column": 1, "offset": 533 }, - "end": { "line": 75, "column": 4, "offset": 573 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';\n``\n", - "position": { - "start": { "line": 77, "column": 1, "offset": 575 }, - "end": { "line": 80, "column": 1, "offset": 597 }, - "indent": [1, 1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 80, "column": 1, "offset": 597 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-c-code.json b/tools/challenge-parser/parser/__fixtures__/ast-c-code.json deleted file mode 100644 index 71d40bd3ce8..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-c-code.json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 24, "offset": 35 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 24, "offset": 35 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n etc: ''\n}", - "position": { - "start": { "line": 5, "column": 1, "offset": 37 }, - "end": { "line": 9, "column": 4, "offset": 66 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "", - "position": { - "start": { "line": 11, "column": 1, "offset": 68 }, - "end": { "line": 13, "column": 4, "offset": 96 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 15, "column": 4, "offset": 101 }, - "end": { "line": 15, "column": 21, "offset": 118 } - } - } - ], - "position": { - "start": { "line": 15, "column": 1, "offset": 98 }, - "end": { "line": 15, "column": 21, "offset": 118 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 17, "column": 1, "offset": 120 }, - "end": { "line": 22, "column": 4, "offset": 165 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 24, "column": 1, "offset": 167 }, - "end": { "line": 28, "column": 4, "offset": 207 } - } - }, - { - "type": "code", - "lang": "c", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 30, "column": 1, "offset": 209 }, - "end": { "line": 32, "column": 4, "offset": 231 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--after-user-code--", - "position": { - "start": { "line": 34, "column": 4, "offset": 236 }, - "end": { "line": 34, "column": 23, "offset": 255 } - } - } - ], - "position": { - "start": { "line": 34, "column": 1, "offset": 233 }, - "end": { "line": 34, "column": 23, "offset": 255 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: blue;\n}", - "position": { - "start": { "line": 36, "column": 1, "offset": 257 }, - "end": { "line": 40, "column": 4, "offset": 296 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "function teardown(params) {\n // after\n}", - "position": { - "start": { "line": 42, "column": 1, "offset": 298 }, - "end": { "line": 46, "column": 4, "offset": 348 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 49, "column": 3, "offset": 353 }, - "end": { "line": 49, "column": 16, "offset": 366 } - } - } - ], - "position": { - "start": { "line": 49, "column": 1, "offset": 351 }, - "end": { "line": 49, "column": 16, "offset": 366 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "image", - "title": null, - "url": "", - "alt": "html-key", - "position": { - "start": { "line": 51, "column": 1, "offset": 368 }, - "end": { "line": 51, "column": 14, "offset": 381 } - } - } - ], - "position": { - "start": { "line": 51, "column": 1, "offset": 368 }, - "end": { "line": 51, "column": 14, "offset": 381 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 53, "column": 1, "offset": 383 }, - "end": { "line": 58, "column": 4, "offset": 428 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 60, "column": 1, "offset": 430 }, - "end": { "line": 64, "column": 4, "offset": 470 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 66, "column": 1, "offset": 472 }, - "end": { "line": 68, "column": 4, "offset": 494 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 69, "column": 1, "offset": 495 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-directives.json b/tools/challenge-parser/parser/__fixtures__/ast-directives.json deleted file mode 100644 index 5d719f653d6..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-directives.json +++ /dev/null @@ -1,185 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "textDirective", - "name": "root", - "attributes": {}, - "children": [], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 6, "offset": 24 } - } - }, - { - "type": "text", - "value": " appears, ", - "position": { - "start": { "line": 3, "column": 6, "offset": 24 }, - "end": { "line": 3, "column": 16, "offset": 34 } - } - }, - { - "type": "textDirective", - "name": "import", - "attributes": {}, - "children": [], - "position": { - "start": { "line": 3, "column": 16, "offset": 34 }, - "end": { "line": 3, "column": 23, "offset": 41 } - } - }, - { - "type": "text", - "value": " appears", - "position": { - "start": { "line": 3, "column": 23, "offset": 41 }, - "end": { "line": 3, "column": 31, "offset": 49 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 31, "offset": 49 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the next paragraph should appear", - "position": { - "start": { "line": 5, "column": 1, "offset": 51 }, - "end": { "line": 5, "column": 33, "offset": 83 } - } - } - ], - "position": { - "start": { "line": 5, "column": 1, "offset": 51 }, - "end": { "line": 5, "column": 33, "offset": 83 } - } - }, - { - "type": "leafDirective", - "name": "import", - "attributes": {}, - "children": [], - "position": { - "start": { "line": 7, "column": 1, "offset": 85 }, - "end": { "line": 7, "column": 9, "offset": 93 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "even though it's an import directive, but if we use the full syntax ", - "position": { - "start": { "line": 9, "column": 1, "offset": 95 }, - "end": { "line": 9, "column": 58, "offset": 152 } - } - }, - { - "type": "inlineCode", - "value": "::directive-name{attr=\"name\" attr2=\"a/path\"}", - "position": { - "start": { "line": 9, "column": 58, "offset": 152 }, - "end": { "line": 9, "column": 100, "offset": 194 } - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 95 }, - "end": { "line": 9, "column": 100, "offset": 194 } - } - }, - { - "type": "leafDirective", - "name": "import", - "attributes": { "component": "name", "from": "script.md" }, - "children": [], - "position": { - "start": { "line": 11, "column": 1, "offset": 196 }, - "end": { "line": 11, "column": 44, "offset": 239 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "it goes.", - "position": { - "start": { "line": 13, "column": 1, "offset": 241 }, - "end": { "line": 13, "column": 9, "offset": 249 } - } - } - ], - "position": { - "start": { "line": 13, "column": 1, "offset": 241 }, - "end": { "line": 13, "column": 9, "offset": 249 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "::: name [inline-content] {key=val}\na container directive\n:::", - "position": { - "start": { "line": 15, "column": 1, "offset": 251 }, - "end": { "line": 17, "column": 4, "offset": 312 } - } - } - ], - "position": { - "start": { "line": 15, "column": 1, "offset": 251 }, - "end": { "line": 17, "column": 4, "offset": 312 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": ":::", - "position": { - "start": { "line": 19, "column": 1, "offset": 314 }, - "end": { "line": 19, "column": 4, "offset": 317 } - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 314 }, - "end": { "line": 19, "column": 4, "offset": 317 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 20, "column": 1, "offset": 318 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-double-marker.json b/tools/challenge-parser/parser/__fixtures__/ast-double-marker.json deleted file mode 100644 index db2976e13d6..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-double-marker.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 21, "offset": 32 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 21, "offset": 32 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n --fcc-editable-region-- --fcc-editable-region--\n \n", - "position": { - "start": { "line": 5, "column": 1, "offset": 34 }, - "end": { "line": 11, "column": 4, "offset": 129 }, - "indent": [1, 1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 13, "column": 1, "offset": 131 }, - "end": { "line": 17, "column": 4, "offset": 171 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 19, "column": 1, "offset": 173 }, - "end": { "line": 21, "column": 4, "offset": 195 }, - "indent": [1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 22, "column": 1, "offset": 196 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-empty-after.json b/tools/challenge-parser/parser/__fixtures__/ast-empty-after.json deleted file mode 100644 index 2c979d07fa2..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-empty-after.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n etc: ''\n}", - "position": { - "start": { "line": 5, "column": 1, "offset": 37 }, - "end": { "line": 9, "column": 4, "offset": 66 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "", - "position": { - "start": { "line": 11, "column": 1, "offset": 68 }, - "end": { "line": 13, "column": 4, "offset": 96 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 15, "column": 4, "offset": 101 }, - "end": { "line": 15, "column": 21, "offset": 118 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 15, "column": 1, "offset": 98 }, - "end": { "line": 15, "column": 21, "offset": 118 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 17, "column": 1, "offset": 120 }, - "end": { "line": 22, "column": 4, "offset": 165 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 24, "column": 1, "offset": 167 }, - "end": { "line": 28, "column": 4, "offset": 207 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 30, "column": 1, "offset": 209 }, - "end": { "line": 32, "column": 4, "offset": 231 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--after-user-code--", - "position": { - "start": { "line": 34, "column": 4, "offset": 236 }, - "end": { "line": 34, "column": 23, "offset": 255 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 34, "column": 1, "offset": 233 }, - "end": { "line": 34, "column": 23, "offset": 255 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 36, "column": 1, "offset": 257 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-empty-before.json b/tools/challenge-parser/parser/__fixtures__/ast-empty-before.json deleted file mode 100644 index ba17c038a2f..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-empty-before.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 7, "column": 4, "offset": 42 }, - "end": { "line": 7, "column": 21, "offset": 59 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 7, "column": 1, "offset": 39 }, - "end": { "line": 7, "column": 21, "offset": 59 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 9, "column": 1, "offset": 61 }, - "end": { "line": 14, "column": 4, "offset": 106 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 16, "column": 1, "offset": 108 }, - "end": { "line": 20, "column": 4, "offset": 148 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 22, "column": 1, "offset": 150 }, - "end": { "line": 24, "column": 4, "offset": 172 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--after-user-code--", - "position": { - "start": { "line": 26, "column": 4, "offset": 177 }, - "end": { "line": 26, "column": 23, "offset": 196 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 26, "column": 1, "offset": 174 }, - "end": { "line": 26, "column": 23, "offset": 196 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: blue;\n}", - "position": { - "start": { "line": 28, "column": 1, "offset": 198 }, - "end": { "line": 32, "column": 4, "offset": 237 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "function teardown(params) {\n // after\n}", - "position": { - "start": { "line": 34, "column": 1, "offset": 239 }, - "end": { "line": 38, "column": 4, "offset": 289 }, - "indent": [1, 1, 1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 39, "column": 1, "offset": 290 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-empty-contents.json b/tools/challenge-parser/parser/__fixtures__/ast-empty-contents.json deleted file mode 100644 index e4fc4cfc5ce..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-empty-contents.json +++ /dev/null @@ -1,448 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 7, "column": 4, "offset": 56 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 9, "column": 3, "offset": 60 }, - "end": { "line": 9, "column": 19, "offset": 76 } - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 58 }, - "end": { "line": 9, "column": 19, "offset": 76 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 } - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 91 }, - "end": { "line": 15, "column": 4, "offset": 117 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 17, "column": 3, "offset": 121 }, - "end": { "line": 17, "column": 12, "offset": 130 } - } - } - ], - "position": { - "start": { "line": 17, "column": 1, "offset": 119 }, - "end": { "line": 17, "column": 12, "offset": 130 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 11, "offset": 142 } - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 11, "offset": 142 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 21, "column": 1, "offset": 144 }, - "end": { "line": 23, "column": 4, "offset": 166 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 25, "column": 1, "offset": 168 }, - "end": { "line": 25, "column": 18, "offset": 185 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 25, "column": 18, "offset": 185 }, - "end": { "line": 25, "column": 24, "offset": 191 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 25, "column": 24, "offset": 191 }, - "end": { "line": 25, "column": 28, "offset": 195 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 25, "column": 28, "offset": 195 }, - "end": { "line": 25, "column": 35, "offset": 202 } - } - } - ], - "position": { - "start": { "line": 25, "column": 1, "offset": 168 }, - "end": { "line": 25, "column": 35, "offset": 202 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 27, "column": 1, "offset": 204 }, - "end": { "line": 29, "column": 4, "offset": 231 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Third ", - "position": { - "start": { "line": 31, "column": 1, "offset": 233 }, - "end": { "line": 31, "column": 7, "offset": 239 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "hint", - "position": { - "start": { "line": 31, "column": 8, "offset": 240 }, - "end": { "line": 31, "column": 12, "offset": 244 } - } - } - ], - "position": { - "start": { "line": 31, "column": 7, "offset": 239 }, - "end": { "line": 31, "column": 13, "offset": 245 } - } - }, - { - "type": "text", - "value": " with ", - "position": { - "start": { "line": 31, "column": 13, "offset": 245 }, - "end": { "line": 31, "column": 19, "offset": 251 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 31, "column": 19, "offset": 251 }, - "end": { "line": 31, "column": 25, "offset": 257 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 31, "column": 25, "offset": 257 }, - "end": { "line": 31, "column": 29, "offset": 261 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 31, "column": 29, "offset": 261 }, - "end": { "line": 31, "column": 36, "offset": 268 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 31, "column": 36, "offset": 268 }, - "end": { "line": 31, "column": 41, "offset": 273 } - } - }, - { - "type": "inlineCode", - "value": "inline code", - "position": { - "start": { "line": 31, "column": 41, "offset": 273 }, - "end": { "line": 31, "column": 54, "offset": 286 } - } - } - ], - "position": { - "start": { "line": 31, "column": 1, "offset": 233 }, - "end": { "line": 31, "column": 54, "offset": 286 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code\nif(let x of xs) {\n console.log(x);\n}", - "position": { - "start": { "line": 33, "column": 1, "offset": 288 }, - "end": { "line": 38, "column": 4, "offset": 353 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 40, "column": 3, "offset": 357 }, - "end": { "line": 40, "column": 11, "offset": 365 } - } - } - ], - "position": { - "start": { "line": 40, "column": 1, "offset": 355 }, - "end": { "line": 40, "column": 11, "offset": 365 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 42, "column": 4, "offset": 370 }, - "end": { "line": 42, "column": 24, "offset": 390 } - } - } - ], - "position": { - "start": { "line": 42, "column": 1, "offset": 367 }, - "end": { "line": 42, "column": 24, "offset": 390 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n etc: ''\n}", - "position": { - "start": { "line": 44, "column": 1, "offset": 392 }, - "end": { "line": 48, "column": 4, "offset": 421 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "", - "position": { - "start": { "line": 50, "column": 1, "offset": 423 }, - "end": { "line": 52, "column": 4, "offset": 451 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--after-user-code--", - "position": { - "start": { "line": 54, "column": 4, "offset": 456 }, - "end": { "line": 54, "column": 23, "offset": 475 } - } - } - ], - "position": { - "start": { "line": 54, "column": 1, "offset": 453 }, - "end": { "line": 54, "column": 23, "offset": 475 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: blue;\n}", - "position": { - "start": { "line": 56, "column": 1, "offset": 477 }, - "end": { "line": 60, "column": 4, "offset": 516 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "function teardown(params) {\n // after\n}", - "position": { - "start": { "line": 62, "column": 1, "offset": 518 }, - "end": { "line": 66, "column": 4, "offset": 568 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 69, "column": 3, "offset": 573 }, - "end": { "line": 69, "column": 16, "offset": 586 } - } - } - ], - "position": { - "start": { "line": 69, "column": 1, "offset": 571 }, - "end": { "line": 69, "column": 16, "offset": 586 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "image", - "title": null, - "url": "", - "alt": "html-key", - "position": { - "start": { "line": 71, "column": 1, "offset": 588 }, - "end": { "line": 71, "column": 14, "offset": 601 } - } - } - ], - "position": { - "start": { "line": 71, "column": 1, "offset": 588 }, - "end": { "line": 71, "column": 14, "offset": 601 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 73, "column": 1, "offset": 603 }, - "end": { "line": 78, "column": 4, "offset": 648 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 80, "column": 1, "offset": 650 }, - "end": { "line": 84, "column": 4, "offset": 690 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';\n``", - "position": { - "start": { "line": 86, "column": 1, "offset": 692 }, - "end": { "line": 89, "column": 1, "offset": 714 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 89, "column": 1, "offset": 714 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-empty-css.json b/tools/challenge-parser/parser/__fixtures__/ast-empty-css.json deleted file mode 100644 index 5a4240d720d..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-empty-css.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n etc: ''\n}", - "position": { - "start": { "line": 5, "column": 1, "offset": 37 }, - "end": { "line": 9, "column": 4, "offset": 66 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "", - "position": { - "start": { "line": 11, "column": 1, "offset": 68 }, - "end": { "line": 13, "column": 4, "offset": 96 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 15, "column": 4, "offset": 101 }, - "end": { "line": 15, "column": 21, "offset": 118 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 15, "column": 1, "offset": 98 }, - "end": { "line": 15, "column": 21, "offset": 118 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 17, "column": 1, "offset": 120 }, - "end": { "line": 22, "column": 4, "offset": 165 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 24, "column": 1, "offset": 167 }, - "end": { "line": 28, "column": 4, "offset": 207 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 30, "column": 1, "offset": 209 }, - "end": { "line": 32, "column": 4, "offset": 231 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--after-user-code--", - "position": { - "start": { "line": 34, "column": 4, "offset": 236 }, - "end": { "line": 34, "column": 23, "offset": 255 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 34, "column": 1, "offset": 233 }, - "end": { "line": 34, "column": 23, "offset": 255 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "", - "position": { - "start": { "line": 36, "column": 1, "offset": 257 }, - "end": { "line": 37, "column": 4, "offset": 267 }, - "indent": [1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "function teardown(params) {\n // after\n}", - "position": { - "start": { "line": 39, "column": 1, "offset": 269 }, - "end": { "line": 43, "column": 4, "offset": 319 }, - "indent": [1, 1, 1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 44, "column": 1, "offset": 320 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-empty-html.json b/tools/challenge-parser/parser/__fixtures__/ast-empty-html.json deleted file mode 100644 index 74724924534..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-empty-html.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n etc: ''\n}", - "position": { - "start": { "line": 5, "column": 1, "offset": 37 }, - "end": { "line": 9, "column": 4, "offset": 66 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "", - "position": { - "start": { "line": 11, "column": 1, "offset": 68 }, - "end": { "line": 12, "column": 4, "offset": 79 }, - "indent": [1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 14, "column": 4, "offset": 84 }, - "end": { "line": 14, "column": 21, "offset": 101 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 14, "column": 1, "offset": 81 }, - "end": { "line": 14, "column": 21, "offset": 101 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 16, "column": 1, "offset": 103 }, - "end": { "line": 21, "column": 4, "offset": 148 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 23, "column": 1, "offset": 150 }, - "end": { "line": 27, "column": 4, "offset": 190 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 29, "column": 1, "offset": 192 }, - "end": { "line": 31, "column": 4, "offset": 214 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--after-user-code--", - "position": { - "start": { "line": 33, "column": 4, "offset": 219 }, - "end": { "line": 33, "column": 23, "offset": 238 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 33, "column": 1, "offset": 216 }, - "end": { "line": 33, "column": 23, "offset": 238 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: blue;\n}", - "position": { - "start": { "line": 35, "column": 1, "offset": 240 }, - "end": { "line": 39, "column": 4, "offset": 279 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "function teardown(params) {\n // after\n}", - "position": { - "start": { "line": 41, "column": 1, "offset": 281 }, - "end": { "line": 45, "column": 4, "offset": 331 }, - "indent": [1, 1, 1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 46, "column": 1, "offset": 332 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-erm-in-solution.json b/tools/challenge-parser/parser/__fixtures__/ast-erm-in-solution.json deleted file mode 100644 index 0f2a5835e31..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-erm-in-solution.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 5, "column": 1, "offset": 34 }, - "end": { "line": 10, "column": 4, "offset": 79 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 12, "column": 1, "offset": 81 }, - "end": { "line": 16, "column": 4, "offset": 121 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 18, "column": 1, "offset": 123 }, - "end": { "line": 20, "column": 4, "offset": 145 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 23, "column": 3, "offset": 150 }, - "end": { "line": 23, "column": 16, "offset": 163 } - } - } - ], - "position": { - "start": { "line": 23, "column": 1, "offset": 148 }, - "end": { "line": 23, "column": 16, "offset": 163 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "html-key" }, - "children": [], - "position": { - "start": { "line": 25, "column": 1, "offset": 165 }, - "end": { "line": 25, "column": 16, "offset": 180 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 27, "column": 1, "offset": 182 }, - "end": { "line": 32, "column": 4, "offset": 227 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n--fcc-editable-region--\n background: white;\n--fcc-editable-region--\n}", - "position": { - "start": { "line": 34, "column": 1, "offset": 229 }, - "end": { "line": 40, "column": 4, "offset": 317 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 42, "column": 1, "offset": 319 }, - "end": { "line": 44, "column": 4, "offset": 341 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 45, "column": 1, "offset": 342 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-exploded-marker.json b/tools/challenge-parser/parser/__fixtures__/ast-exploded-marker.json deleted file mode 100644 index b8a0dc8a6a8..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-exploded-marker.json +++ /dev/null @@ -1,533 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 7, "column": 4, "offset": 56 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 9, "column": 3, "offset": 60 }, - "end": { "line": 9, "column": 19, "offset": 76 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 58 }, - "end": { "line": 9, "column": 19, "offset": 76 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 91 }, - "end": { "line": 15, "column": 4, "offset": 117 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 17, "column": 3, "offset": 121 }, - "end": { "line": 17, "column": 12, "offset": 130 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 17, "column": 1, "offset": 119 }, - "end": { "line": 17, "column": 12, "offset": 130 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-1", - "label": "test-id-1", - "referenceType": "shortcut", - "alt": "test-id-1", - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 13, "offset": 144 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 13, "offset": 144 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 21, "column": 1, "offset": 146 }, - "end": { "line": 21, "column": 11, "offset": 156 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 21, "column": 1, "offset": 146 }, - "end": { "line": 21, "column": 11, "offset": 156 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 23, "column": 1, "offset": 158 }, - "end": { "line": 25, "column": 4, "offset": 180 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-2", - "label": "test-id-2", - "referenceType": "shortcut", - "alt": "test-id-2", - "position": { - "start": { "line": 27, "column": 1, "offset": 182 }, - "end": { "line": 27, "column": 13, "offset": 194 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 27, "column": 1, "offset": 182 }, - "end": { "line": 27, "column": 13, "offset": 194 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 29, "column": 1, "offset": 196 }, - "end": { "line": 29, "column": 18, "offset": 213 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 29, "column": 18, "offset": 213 }, - "end": { "line": 29, "column": 24, "offset": 219 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 29, "column": 24, "offset": 219 }, - "end": { "line": 29, "column": 28, "offset": 223 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 29, "column": 28, "offset": 223 }, - "end": { "line": 29, "column": 35, "offset": 230 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 29, "column": 1, "offset": 196 }, - "end": { "line": 29, "column": 35, "offset": 230 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 31, "column": 1, "offset": 232 }, - "end": { "line": 33, "column": 4, "offset": 259 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-3", - "label": "test-id-3", - "referenceType": "shortcut", - "alt": "test-id-3", - "position": { - "start": { "line": 35, "column": 1, "offset": 261 }, - "end": { "line": 35, "column": 13, "offset": 273 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 261 }, - "end": { "line": 35, "column": 13, "offset": 273 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Third ", - "position": { - "start": { "line": 37, "column": 1, "offset": 275 }, - "end": { "line": 37, "column": 7, "offset": 281 }, - "indent": [] - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "hint", - "position": { - "start": { "line": 37, "column": 8, "offset": 282 }, - "end": { "line": 37, "column": 12, "offset": 286 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 7, "offset": 281 }, - "end": { "line": 37, "column": 13, "offset": 287 }, - "indent": [] - } - }, - { - "type": "text", - "value": " with ", - "position": { - "start": { "line": 37, "column": 13, "offset": 287 }, - "end": { "line": 37, "column": 19, "offset": 293 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 37, "column": 19, "offset": 293 }, - "end": { "line": 37, "column": 25, "offset": 299 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 37, "column": 25, "offset": 299 }, - "end": { "line": 37, "column": 29, "offset": 303 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 37, "column": 29, "offset": 303 }, - "end": { "line": 37, "column": 36, "offset": 310 }, - "indent": [] - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 37, "column": 36, "offset": 310 }, - "end": { "line": 37, "column": 41, "offset": 315 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "inline code", - "position": { - "start": { "line": 37, "column": 41, "offset": 315 }, - "end": { "line": 37, "column": 54, "offset": 328 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 1, "offset": 275 }, - "end": { "line": 37, "column": 54, "offset": 328 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code\nif(let x of xs) {\n console.log(x);\n}", - "position": { - "start": { "line": 39, "column": 1, "offset": 330 }, - "end": { "line": 44, "column": 4, "offset": 395 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 46, "column": 3, "offset": 399 }, - "end": { "line": 46, "column": 11, "offset": 407 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 46, "column": 1, "offset": 397 }, - "end": { "line": 46, "column": 11, "offset": 407 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 48, "column": 4, "offset": 412 }, - "end": { "line": 48, "column": 21, "offset": 429 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 48, "column": 1, "offset": 409 }, - "end": { "line": 48, "column": 21, "offset": 429 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n", - "position": { - "start": { "line": 50, "column": 1, "offset": 431 }, - "end": { "line": 54, "column": 4, "offset": 473 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n--fcc-editable-region--\n background: green;\n\n--fcc-editable-region--\n}", - "position": { - "start": { "line": 56, "column": 1, "offset": 475 }, - "end": { "line": 63, "column": 4, "offset": 564 }, - "indent": [1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "--fcc - editable - region--;\nvar x = 'y';", - "position": { - "start": { "line": 65, "column": 1, "offset": 566 }, - "end": { "line": 68, "column": 4, "offset": 617 }, - "indent": [1, 1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 70, "column": 3, "offset": 621 }, - "end": { "line": 70, "column": 16, "offset": 634 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 70, "column": 1, "offset": 619 }, - "end": { "line": 70, "column": 16, "offset": 634 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 72, "column": 1, "offset": 636 }, - "end": { "line": 72, "column": 12, "offset": 647 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 72, "column": 1, "offset": 636 }, - "end": { "line": 72, "column": 12, "offset": 647 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n", - "position": { - "start": { "line": 74, "column": 1, "offset": 649 }, - "end": { "line": 78, "column": 4, "offset": 691 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 80, "column": 1, "offset": 693 }, - "end": { "line": 84, "column": 4, "offset": 733 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 86, "column": 1, "offset": 735 }, - "end": { "line": 88, "column": 4, "offset": 757 }, - "indent": [1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 89, "column": 1, "offset": 758 } - } -} \ No newline at end of file diff --git a/tools/challenge-parser/parser/__fixtures__/ast-extra-heading.json b/tools/challenge-parser/parser/__fixtures__/ast-extra-heading.json deleted file mode 100644 index 720025faf49..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-extra-heading.json +++ /dev/null @@ -1,427 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 7, "column": 4, "offset": 56 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "a heading", - "position": { - "start": { "line": 9, "column": 3, "offset": 60 }, - "end": { "line": 9, "column": 12, "offset": 69 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 58 }, - "end": { "line": 9, "column": 12, "offset": 69 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "this should still be inside --description--", - "position": { - "start": { "line": 11, "column": 1, "offset": 71 }, - "end": { "line": 11, "column": 44, "offset": 114 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 71 }, - "end": { "line": 11, "column": 44, "offset": 114 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 13, "column": 3, "offset": 118 }, - "end": { "line": 13, "column": 19, "offset": 134 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 13, "column": 1, "offset": 116 }, - "end": { "line": 13, "column": 19, "offset": 134 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 15, "column": 1, "offset": 136 }, - "end": { "line": 15, "column": 12, "offset": 147 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 15, "column": 1, "offset": 136 }, - "end": { "line": 15, "column": 12, "offset": 147 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 17, "column": 1, "offset": 149 }, - "end": { "line": 19, "column": 4, "offset": 175 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 21, "column": 3, "offset": 179 }, - "end": { "line": 21, "column": 12, "offset": 188 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 21, "column": 1, "offset": 177 }, - "end": { "line": 21, "column": 12, "offset": 188 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-1", - "label": "test-id-1", - "referenceType": "shortcut", - "alt": "test-id-1", - "position": { - "start": { "line": 23, "column": 1, "offset": 190 }, - "end": { "line": 23, "column": 13, "offset": 202 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 23, "column": 1, "offset": 190 }, - "end": { "line": 23, "column": 13, "offset": 202 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 25, "column": 1, "offset": 204 }, - "end": { "line": 25, "column": 11, "offset": 214 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 25, "column": 1, "offset": 204 }, - "end": { "line": 25, "column": 11, "offset": 214 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 27, "column": 1, "offset": 216 }, - "end": { "line": 29, "column": 4, "offset": 238 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-2", - "label": "test-id-2", - "referenceType": "shortcut", - "alt": "test-id-2", - "position": { - "start": { "line": 31, "column": 1, "offset": 240 }, - "end": { "line": 31, "column": 13, "offset": 252 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 31, "column": 1, "offset": 240 }, - "end": { "line": 31, "column": 13, "offset": 252 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 33, "column": 1, "offset": 254 }, - "end": { "line": 33, "column": 18, "offset": 271 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 33, "column": 18, "offset": 271 }, - "end": { "line": 33, "column": 24, "offset": 277 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 33, "column": 24, "offset": 277 }, - "end": { "line": 33, "column": 28, "offset": 281 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 33, "column": 28, "offset": 281 }, - "end": { "line": 33, "column": 35, "offset": 288 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 33, "column": 1, "offset": 254 }, - "end": { "line": 33, "column": 35, "offset": 288 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 35, "column": 1, "offset": 290 }, - "end": { "line": 37, "column": 4, "offset": 317 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 39, "column": 3, "offset": 321 }, - "end": { "line": 39, "column": 11, "offset": 329 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 39, "column": 1, "offset": 319 }, - "end": { "line": 39, "column": 11, "offset": 329 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 41, "column": 1, "offset": 331 }, - "end": { "line": 46, "column": 4, "offset": 376 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 48, "column": 1, "offset": 378 }, - "end": { "line": 52, "column": 4, "offset": 418 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 54, "column": 1, "offset": 420 }, - "end": { "line": 56, "column": 4, "offset": 442 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 59, "column": 3, "offset": 447 }, - "end": { "line": 59, "column": 15, "offset": 459 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 59, "column": 1, "offset": 445 }, - "end": { "line": 59, "column": 15, "offset": 459 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 61, "column": 1, "offset": 461 }, - "end": { "line": 61, "column": 12, "offset": 472 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 61, "column": 1, "offset": 461 }, - "end": { "line": 61, "column": 12, "offset": 472 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 63, "column": 1, "offset": 474 }, - "end": { "line": 68, "column": 4, "offset": 519 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 70, "column": 1, "offset": 521 }, - "end": { "line": 74, "column": 4, "offset": 561 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';\n``\n", - "position": { - "start": { "line": 76, "column": 1, "offset": 563 }, - "end": { "line": 79, "column": 1, "offset": 585 }, - "indent": [1, 1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 79, "column": 1, "offset": 585 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-bad-paragraph.json b/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-bad-paragraph.json deleted file mode 100644 index 738dd09734a..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-bad-paragraph.json +++ /dev/null @@ -1,563 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { - "line": 1, - "column": 3, - "offset": 2 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In English, to check or confirm something people sometimes use tag questions. For example, ", - "position": { - "start": { - "line": 3, - "column": 1, - "offset": 19 - }, - "end": { - "line": 3, - "column": 92, - "offset": 110 - } - } - }, - { - "type": "inlineCode", - "value": "You are a programmer, right?", - "position": { - "start": { - "line": 3, - "column": 92, - "offset": 110 - }, - "end": { - "line": 3, - "column": 122, - "offset": 140 - } - } - }, - { - "type": "text", - "value": " Here, ", - "position": { - "start": { - "line": 3, - "column": 122, - "offset": 140 - }, - "end": { - "line": 3, - "column": 129, - "offset": 147 - } - } - }, - { - "type": "inlineCode", - "value": "right?", - "position": { - "start": { - "line": 3, - "column": 129, - "offset": 147 - }, - "end": { - "line": 3, - "column": 137, - "offset": 155 - } - } - }, - { - "type": "text", - "value": " is used as a tag to check or confirm the previous statement.", - "position": { - "start": { - "line": 3, - "column": 137, - "offset": 155 - }, - "end": { - "line": 3, - "column": 198, - "offset": 216 - } - } - } - ], - "position": { - "start": { - "line": 3, - "column": 1, - "offset": 19 - }, - "end": { - "line": 3, - "column": 198, - "offset": 216 - } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--fillInTheBlank--", - "position": { - "start": { - "line": 5, - "column": 3, - "offset": 220 - }, - "end": { - "line": 5, - "column": 21, - "offset": 238 - } - } - } - ], - "position": { - "start": { - "line": 5, - "column": 1, - "offset": 218 - }, - "end": { - "line": 5, - "column": 21, - "offset": 238 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--sentence--", - "position": { - "start": { - "line": 7, - "column": 4, - "offset": 243 - }, - "end": { - "line": 7, - "column": 16, - "offset": 255 - } - } - } - ], - "position": { - "start": { - "line": 7, - "column": 1, - "offset": 240 - }, - "end": { - "line": 7, - "column": 16, - "offset": 255 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "A sentence BLANK paragraph 1", - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 257 - }, - "end": { - "line": 9, - "column": 27, - "offset": 283 - } - } - }, - { - "type": "text", - "value": "\n", - "position": { - "start": { - "line": 9, - "column": 27, - "offset": 283 - }, - "end": { - "line": 10, - "column": 1, - "offset": 284 - } - } - }, - { - "type": "inlineCode", - "value": "not enough newlines, so no paragraph 2", - "position": { - "start": { - "line": 10, - "column": 1, - "offset": 284 - }, - "end": { - "line": 10, - "column": 41, - "offset": 324 - } - } - } - ], - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 257 - }, - "end": { - "line": 10, - "column": 41, - "offset": 324 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sentence in BLANK 2", - "position": { - "start": { - "line": 12, - "column": 1, - "offset": 326 - }, - "end": { - "line": 12, - "column": 16, - "offset": 341 - } - } - } - ], - "position": { - "start": { - "line": 12, - "column": 1, - "offset": 326 - }, - "end": { - "line": 12, - "column": 16, - "offset": 341 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--blanks--", - "position": { - "start": { - "line": 14, - "column": 4, - "offset": 346 - }, - "end": { - "line": 14, - "column": 14, - "offset": 356 - } - } - } - ], - "position": { - "start": { - "line": 14, - "column": 1, - "offset": 343 - }, - "end": { - "line": 14, - "column": 14, - "offset": 356 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "are", - "position": { - "start": { - "line": 16, - "column": 1, - "offset": 358 - }, - "end": { - "line": 16, - "column": 6, - "offset": 363 - } - } - } - ], - "position": { - "start": { - "line": 16, - "column": 1, - "offset": 358 - }, - "end": { - "line": 16, - "column": 6, - "offset": 363 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 18, - "column": 5, - "offset": 369 - }, - "end": { - "line": 18, - "column": 17, - "offset": 381 - } - } - } - ], - "position": { - "start": { - "line": 18, - "column": 1, - "offset": 365 - }, - "end": { - "line": 18, - "column": 17, - "offset": 381 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Pay attention to the verb in the sentence.", - "position": { - "start": { - "line": 20, - "column": 1, - "offset": 383 - }, - "end": { - "line": 20, - "column": 43, - "offset": 425 - } - } - } - ], - "position": { - "start": { - "line": 20, - "column": 1, - "offset": 383 - }, - "end": { - "line": 20, - "column": 43, - "offset": 425 - } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { - "line": 22, - "column": 1, - "offset": 427 - }, - "end": { - "line": 22, - "column": 4, - "offset": 430 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "right", - "position": { - "start": { - "line": 24, - "column": 1, - "offset": 432 - }, - "end": { - "line": 24, - "column": 8, - "offset": 439 - } - } - } - ], - "position": { - "start": { - "line": 24, - "column": 1, - "offset": 432 - }, - "end": { - "line": 24, - "column": 8, - "offset": 439 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 26, - "column": 5, - "offset": 445 - }, - "end": { - "line": 26, - "column": 17, - "offset": 457 - } - } - } - ], - "position": { - "start": { - "line": 26, - "column": 1, - "offset": 441 - }, - "end": { - "line": 26, - "column": 17, - "offset": 457 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Pay attention to the verb in the sentence.", - "position": { - "start": { - "line": 28, - "column": 1, - "offset": 459 - }, - "end": { - "line": 28, - "column": 43, - "offset": 501 - } - } - } - ], - "position": { - "start": { - "line": 28, - "column": 1, - "offset": 459 - }, - "end": { - "line": 28, - "column": 43, - "offset": 501 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 29, - "column": 1, - "offset": 502 - } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-bad-sentence.json b/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-bad-sentence.json deleted file mode 100644 index afe897065d4..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-bad-sentence.json +++ /dev/null @@ -1,531 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { - "line": 1, - "column": 3, - "offset": 2 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In English, to check or confirm something people sometimes use tag questions. For example, ", - "position": { - "start": { - "line": 3, - "column": 1, - "offset": 19 - }, - "end": { - "line": 3, - "column": 92, - "offset": 110 - } - } - }, - { - "type": "inlineCode", - "value": "You are a programmer, right?", - "position": { - "start": { - "line": 3, - "column": 92, - "offset": 110 - }, - "end": { - "line": 3, - "column": 122, - "offset": 140 - } - } - }, - { - "type": "text", - "value": " Here, ", - "position": { - "start": { - "line": 3, - "column": 122, - "offset": 140 - }, - "end": { - "line": 3, - "column": 129, - "offset": 147 - } - } - }, - { - "type": "inlineCode", - "value": "right?", - "position": { - "start": { - "line": 3, - "column": 129, - "offset": 147 - }, - "end": { - "line": 3, - "column": 137, - "offset": 155 - } - } - }, - { - "type": "text", - "value": " is used as a tag to check or confirm the previous statement.", - "position": { - "start": { - "line": 3, - "column": 137, - "offset": 155 - }, - "end": { - "line": 3, - "column": 198, - "offset": 216 - } - } - } - ], - "position": { - "start": { - "line": 3, - "column": 1, - "offset": 19 - }, - "end": { - "line": 3, - "column": 198, - "offset": 216 - } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--fillInTheBlank--", - "position": { - "start": { - "line": 5, - "column": 3, - "offset": 220 - }, - "end": { - "line": 5, - "column": 21, - "offset": 238 - } - } - } - ], - "position": { - "start": { - "line": 5, - "column": 1, - "offset": 218 - }, - "end": { - "line": 5, - "column": 21, - "offset": 238 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--sentence--", - "position": { - "start": { - "line": 7, - "column": 4, - "offset": 243 - }, - "end": { - "line": 7, - "column": 16, - "offset": 255 - } - } - } - ], - "position": { - "start": { - "line": 7, - "column": 1, - "offset": 240 - }, - "end": { - "line": 7, - "column": 16, - "offset": 255 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "A sentence BLANK paragraph 1", - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 257 - }, - "end": { - "line": 9, - "column": 27, - "offset": 283 - } - } - } - ], - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 257 - }, - "end": { - "line": 9, - "column": 27, - "offset": 283 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sentence in BLANK 2", - "position": { - "start": { - "line": 11, - "column": 1, - "offset": 285 - }, - "end": { - "line": 11, - "column": 16, - "offset": 300 - } - } - } - ], - "position": { - "start": { - "line": 11, - "column": 1, - "offset": 285 - }, - "end": { - "line": 11, - "column": 16, - "offset": 300 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--blanks--", - "position": { - "start": { - "line": 13, - "column": 4, - "offset": 305 - }, - "end": { - "line": 13, - "column": 14, - "offset": 315 - } - } - } - ], - "position": { - "start": { - "line": 13, - "column": 1, - "offset": 302 - }, - "end": { - "line": 13, - "column": 14, - "offset": 315 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "are", - "position": { - "start": { - "line": 15, - "column": 1, - "offset": 317 - }, - "end": { - "line": 15, - "column": 6, - "offset": 322 - } - } - } - ], - "position": { - "start": { - "line": 15, - "column": 1, - "offset": 317 - }, - "end": { - "line": 15, - "column": 6, - "offset": 322 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 17, - "column": 5, - "offset": 328 - }, - "end": { - "line": 17, - "column": 17, - "offset": 340 - } - } - } - ], - "position": { - "start": { - "line": 17, - "column": 1, - "offset": 324 - }, - "end": { - "line": 17, - "column": 17, - "offset": 340 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Pay attention to the verb in the sentence.", - "position": { - "start": { - "line": 19, - "column": 1, - "offset": 342 - }, - "end": { - "line": 19, - "column": 43, - "offset": 384 - } - } - } - ], - "position": { - "start": { - "line": 19, - "column": 1, - "offset": 342 - }, - "end": { - "line": 19, - "column": 43, - "offset": 384 - } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { - "line": 21, - "column": 1, - "offset": 386 - }, - "end": { - "line": 21, - "column": 4, - "offset": 389 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "right", - "position": { - "start": { - "line": 23, - "column": 1, - "offset": 391 - }, - "end": { - "line": 23, - "column": 8, - "offset": 398 - } - } - } - ], - "position": { - "start": { - "line": 23, - "column": 1, - "offset": 391 - }, - "end": { - "line": 23, - "column": 8, - "offset": 398 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 25, - "column": 5, - "offset": 404 - }, - "end": { - "line": 25, - "column": 17, - "offset": 416 - } - } - } - ], - "position": { - "start": { - "line": 25, - "column": 1, - "offset": 400 - }, - "end": { - "line": 25, - "column": 17, - "offset": 416 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Pay attention to the verb in the sentence.", - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 418 - }, - "end": { - "line": 27, - "column": 43, - "offset": 460 - } - } - } - ], - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 418 - }, - "end": { - "line": 27, - "column": 43, - "offset": 460 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 28, - "column": 1, - "offset": 461 - } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-many-blanks.json b/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-many-blanks.json deleted file mode 100644 index 4e09e56fdef..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-many-blanks.json +++ /dev/null @@ -1,520 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--fillInTheBlank--", - "position": { - "start": { - "line": 1, - "column": 3, - "offset": 2 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 21, - "offset": 20 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--sentence--", - "position": { - "start": { - "line": 3, - "column": 4, - "offset": 25 - }, - "end": { - "line": 3, - "column": 16, - "offset": 37 - } - } - } - ], - "position": { - "start": { - "line": 3, - "column": 1, - "offset": 22 - }, - "end": { - "line": 3, - "column": 16, - "offset": 37 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Sure thing! BLANK BLANK BLANK.", - "position": { - "start": { - "line": 5, - "column": 1, - "offset": 39 - }, - "end": { - "line": 5, - "column": 21, - "offset": 59 - } - } - } - ], - "position": { - "start": { - "line": 5, - "column": 1, - "offset": 39 - }, - "end": { - "line": 5, - "column": 21, - "offset": 59 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--blanks--", - "position": { - "start": { - "line": 7, - "column": 4, - "offset": 64 - }, - "end": { - "line": 7, - "column": 14, - "offset": 74 - } - } - } - ], - "position": { - "start": { - "line": 7, - "column": 1, - "offset": 61 - }, - "end": { - "line": 7, - "column": 14, - "offset": 74 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "I'd", - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 76 - }, - "end": { - "line": 9, - "column": 6, - "offset": 81 - } - } - } - ], - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 76 - }, - "end": { - "line": 9, - "column": 6, - "offset": 81 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 11, - "column": 5, - "offset": 87 - }, - "end": { - "line": 11, - "column": 17, - "offset": 99 - } - } - } - ], - "position": { - "start": { - "line": 11, - "column": 1, - "offset": 83 - }, - "end": { - "line": 11, - "column": 17, - "offset": 99 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Feedback 1", - "position": { - "start": { - "line": 13, - "column": 1, - "offset": 101 - }, - "end": { - "line": 13, - "column": 11, - "offset": 111 - } - } - } - ], - "position": { - "start": { - "line": 13, - "column": 1, - "offset": 101 - }, - "end": { - "line": 13, - "column": 11, - "offset": 111 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--blanks--", - "position": { - "start": { - "line": 15, - "column": 4, - "offset": 116 - }, - "end": { - "line": 15, - "column": 14, - "offset": 126 - } - } - } - ], - "position": { - "start": { - "line": 15, - "column": 1, - "offset": 113 - }, - "end": { - "line": 15, - "column": 14, - "offset": 126 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "love", - "position": { - "start": { - "line": 17, - "column": 1, - "offset": 128 - }, - "end": { - "line": 17, - "column": 7, - "offset": 134 - } - } - } - ], - "position": { - "start": { - "line": 17, - "column": 1, - "offset": 128 - }, - "end": { - "line": 17, - "column": 7, - "offset": 134 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 19, - "column": 5, - "offset": 140 - }, - "end": { - "line": 19, - "column": 17, - "offset": 152 - } - } - } - ], - "position": { - "start": { - "line": 19, - "column": 1, - "offset": 136 - }, - "end": { - "line": 19, - "column": 17, - "offset": 152 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Feedback 2", - "position": { - "start": { - "line": 21, - "column": 1, - "offset": 154 - }, - "end": { - "line": 21, - "column": 11, - "offset": 164 - } - } - } - ], - "position": { - "start": { - "line": 21, - "column": 1, - "offset": 154 - }, - "end": { - "line": 21, - "column": 11, - "offset": 164 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--blanks--", - "position": { - "start": { - "line": 23, - "column": 4, - "offset": 169 - }, - "end": { - "line": 23, - "column": 14, - "offset": 179 - } - } - } - ], - "position": { - "start": { - "line": 23, - "column": 1, - "offset": 166 - }, - "end": { - "line": 23, - "column": 14, - "offset": 179 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "to", - "position": { - "start": { - "line": 25, - "column": 1, - "offset": 181 - }, - "end": { - "line": 25, - "column": 5, - "offset": 185 - } - } - } - ], - "position": { - "start": { - "line": 25, - "column": 1, - "offset": 181 - }, - "end": { - "line": 25, - "column": 5, - "offset": 185 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 27, - "column": 5, - "offset": 191 - }, - "end": { - "line": 27, - "column": 17, - "offset": 203 - } - } - } - ], - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 187 - }, - "end": { - "line": 27, - "column": 17, - "offset": 203 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Feedback 3", - "position": { - "start": { - "line": 29, - "column": 1, - "offset": 205 - }, - "end": { - "line": 29, - "column": 11, - "offset": 215 - } - } - } - ], - "position": { - "start": { - "line": 29, - "column": 1, - "offset": 205 - }, - "end": { - "line": 29, - "column": 11, - "offset": 215 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 30, - "column": 1, - "offset": 216 - } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-one-blank.json b/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-one-blank.json deleted file mode 100644 index ebafaeccd25..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-one-blank.json +++ /dev/null @@ -1,592 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { - "line": 9, - "column": 3, - "offset": 159 - }, - "end": { - "line": 9, - "column": 18, - "offset": 174 - } - } - } - ], - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 157 - }, - "end": { - "line": 9, - "column": 18, - "offset": 174 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In English, when making introductions or identifying someone, you use the verb ", - "position": { - "start": { - "line": 11, - "column": 1, - "offset": 176 - }, - "end": { - "line": 11, - "column": 80, - "offset": 255 - } - } - }, - { - "type": "inlineCode", - "value": "to be", - "position": { - "start": { - "line": 11, - "column": 80, - "offset": 255 - }, - "end": { - "line": 11, - "column": 87, - "offset": 262 - } - } - }, - { - "type": "text", - "value": ". In this case, ", - "position": { - "start": { - "line": 11, - "column": 87, - "offset": 262 - }, - "end": { - "line": 11, - "column": 103, - "offset": 278 - } - } - }, - { - "type": "inlineCode", - "value": "You are", - "position": { - "start": { - "line": 11, - "column": 103, - "offset": 278 - }, - "end": { - "line": 11, - "column": 112, - "offset": 287 - } - } - }, - { - "type": "text", - "value": " is used to address the person Maria is talking to and affirmatively identify their occupation.", - "position": { - "start": { - "line": 11, - "column": 112, - "offset": 287 - }, - "end": { - "line": 11, - "column": 207, - "offset": 382 - } - } - } - ], - "position": { - "start": { - "line": 11, - "column": 1, - "offset": 176 - }, - "end": { - "line": 11, - "column": 207, - "offset": 382 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Maria is introducing herself and confirming Tom's job role. ", - "position": { - "start": { - "line": 13, - "column": 1, - "offset": 384 - }, - "end": { - "line": 13, - "column": 61, - "offset": 444 - } - } - }, - { - "type": "inlineCode", - "value": "Are", - "position": { - "start": { - "line": 13, - "column": 61, - "offset": 444 - }, - "end": { - "line": 13, - "column": 66, - "offset": 449 - } - } - }, - { - "type": "text", - "value": " is used in the present affirmative to make a statement.", - "position": { - "start": { - "line": 13, - "column": 66, - "offset": 449 - }, - "end": { - "line": 13, - "column": 122, - "offset": 505 - } - } - } - ], - "position": { - "start": { - "line": 13, - "column": 1, - "offset": 384 - }, - "end": { - "line": 13, - "column": 122, - "offset": 505 - } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--fillInTheBlank--", - "position": { - "start": { - "line": 15, - "column": 3, - "offset": 509 - }, - "end": { - "line": 15, - "column": 21, - "offset": 527 - } - } - } - ], - "position": { - "start": { - "line": 15, - "column": 1, - "offset": 507 - }, - "end": { - "line": 15, - "column": 21, - "offset": 527 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--sentence--", - "position": { - "start": { - "line": 17, - "column": 4, - "offset": 532 - }, - "end": { - "line": 17, - "column": 16, - "offset": 544 - } - } - } - ], - "position": { - "start": { - "line": 17, - "column": 1, - "offset": 529 - }, - "end": { - "line": 17, - "column": 16, - "offset": 544 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Hello, You BLANK the new graphic designer, right?", - "position": { - "start": { - "line": 19, - "column": 1, - "offset": 546 - }, - "end": { - "line": 19, - "column": 48, - "offset": 593 - } - } - } - ], - "position": { - "start": { - "line": 19, - "column": 1, - "offset": 546 - }, - "end": { - "line": 19, - "column": 48, - "offset": 593 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--blanks--", - "position": { - "start": { - "line": 21, - "column": 4, - "offset": 598 - }, - "end": { - "line": 21, - "column": 14, - "offset": 608 - } - } - } - ], - "position": { - "start": { - "line": 21, - "column": 1, - "offset": 595 - }, - "end": { - "line": 21, - "column": 14, - "offset": 608 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "are", - "position": { - "start": { - "line": 23, - "column": 1, - "offset": 610 - }, - "end": { - "line": 23, - "column": 6, - "offset": 615 - } - } - } - ], - "position": { - "start": { - "line": 23, - "column": 1, - "offset": 610 - }, - "end": { - "line": 23, - "column": 6, - "offset": 615 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 25, - "column": 5, - "offset": 621 - }, - "end": { - "line": 25, - "column": 17, - "offset": 633 - } - } - } - ], - "position": { - "start": { - "line": 25, - "column": 1, - "offset": 617 - }, - "end": { - "line": 25, - "column": 17, - "offset": 633 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The verb ", - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 635 - }, - "end": { - "line": 27, - "column": 10, - "offset": 644 - } - } - }, - { - "type": "inlineCode", - "value": "to be", - "position": { - "start": { - "line": 27, - "column": 10, - "offset": 644 - }, - "end": { - "line": 27, - "column": 17, - "offset": 651 - } - } - }, - { - "type": "text", - "value": " is an irregular verb. When conjugated with the pronoun ", - "position": { - "start": { - "line": 27, - "column": 17, - "offset": 651 - }, - "end": { - "line": 27, - "column": 73, - "offset": 707 - } - } - }, - { - "type": "inlineCode", - "value": "you", - "position": { - "start": { - "line": 27, - "column": 73, - "offset": 707 - }, - "end": { - "line": 27, - "column": 78, - "offset": 712 - } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { - "line": 27, - "column": 78, - "offset": 712 - }, - "end": { - "line": 27, - "column": 80, - "offset": 714 - } - } - }, - { - "type": "inlineCode", - "value": "be", - "position": { - "start": { - "line": 27, - "column": 80, - "offset": 714 - }, - "end": { - "line": 27, - "column": 84, - "offset": 718 - } - } - }, - { - "type": "text", - "value": " becomes ", - "position": { - "start": { - "line": 27, - "column": 84, - "offset": 718 - }, - "end": { - "line": 27, - "column": 93, - "offset": 727 - } - } - }, - { - "type": "inlineCode", - "value": "are", - "position": { - "start": { - "line": 27, - "column": 93, - "offset": 727 - }, - "end": { - "line": 27, - "column": 98, - "offset": 732 - } - } - }, - { - "type": "text", - "value": ". For example: ", - "position": { - "start": { - "line": 27, - "column": 98, - "offset": 732 - }, - "end": { - "line": 27, - "column": 113, - "offset": 747 - } - } - }, - { - "type": "inlineCode", - "value": "You are an English learner.", - "position": { - "start": { - "line": 27, - "column": 113, - "offset": 747 - }, - "end": { - "line": 27, - "column": 142, - "offset": 776 - } - } - } - ], - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 635 - }, - "end": { - "line": 27, - "column": 142, - "offset": 776 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 28, - "column": 1, - "offset": 777 - } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-two-sentences.json b/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-two-sentences.json deleted file mode 100644 index 8b7e5e54eb9..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank-two-sentences.json +++ /dev/null @@ -1,531 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { - "line": 1, - "column": 3, - "offset": 2 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In English, to check or confirm something people sometimes use tag questions. For example, ", - "position": { - "start": { - "line": 3, - "column": 1, - "offset": 19 - }, - "end": { - "line": 3, - "column": 92, - "offset": 110 - } - } - }, - { - "type": "inlineCode", - "value": "You are a programmer, right?", - "position": { - "start": { - "line": 3, - "column": 92, - "offset": 110 - }, - "end": { - "line": 3, - "column": 122, - "offset": 140 - } - } - }, - { - "type": "text", - "value": " Here, ", - "position": { - "start": { - "line": 3, - "column": 122, - "offset": 140 - }, - "end": { - "line": 3, - "column": 129, - "offset": 147 - } - } - }, - { - "type": "inlineCode", - "value": "right?", - "position": { - "start": { - "line": 3, - "column": 129, - "offset": 147 - }, - "end": { - "line": 3, - "column": 137, - "offset": 155 - } - } - }, - { - "type": "text", - "value": " is used as a tag to check or confirm the previous statement.", - "position": { - "start": { - "line": 3, - "column": 137, - "offset": 155 - }, - "end": { - "line": 3, - "column": 198, - "offset": 216 - } - } - } - ], - "position": { - "start": { - "line": 3, - "column": 1, - "offset": 19 - }, - "end": { - "line": 3, - "column": 198, - "offset": 216 - } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--fillInTheBlank--", - "position": { - "start": { - "line": 5, - "column": 3, - "offset": 220 - }, - "end": { - "line": 5, - "column": 21, - "offset": 238 - } - } - } - ], - "position": { - "start": { - "line": 5, - "column": 1, - "offset": 218 - }, - "end": { - "line": 5, - "column": 21, - "offset": 238 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--sentence--", - "position": { - "start": { - "line": 7, - "column": 4, - "offset": 243 - }, - "end": { - "line": 7, - "column": 16, - "offset": 255 - } - } - } - ], - "position": { - "start": { - "line": 7, - "column": 1, - "offset": 240 - }, - "end": { - "line": 7, - "column": 16, - "offset": 255 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "A sentence BLANK paragraph 1", - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 257 - }, - "end": { - "line": 9, - "column": 27, - "offset": 283 - } - } - } - ], - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 257 - }, - "end": { - "line": 9, - "column": 27, - "offset": 283 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Sentence in BLANK 2", - "position": { - "start": { - "line": 11, - "column": 1, - "offset": 285 - }, - "end": { - "line": 11, - "column": 18, - "offset": 302 - } - } - } - ], - "position": { - "start": { - "line": 11, - "column": 1, - "offset": 285 - }, - "end": { - "line": 11, - "column": 18, - "offset": 302 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--blanks--", - "position": { - "start": { - "line": 13, - "column": 4, - "offset": 307 - }, - "end": { - "line": 13, - "column": 14, - "offset": 317 - } - } - } - ], - "position": { - "start": { - "line": 13, - "column": 1, - "offset": 304 - }, - "end": { - "line": 13, - "column": 14, - "offset": 317 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "are", - "position": { - "start": { - "line": 15, - "column": 1, - "offset": 319 - }, - "end": { - "line": 15, - "column": 6, - "offset": 324 - } - } - } - ], - "position": { - "start": { - "line": 15, - "column": 1, - "offset": 319 - }, - "end": { - "line": 15, - "column": 6, - "offset": 324 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 17, - "column": 5, - "offset": 330 - }, - "end": { - "line": 17, - "column": 17, - "offset": 342 - } - } - } - ], - "position": { - "start": { - "line": 17, - "column": 1, - "offset": 326 - }, - "end": { - "line": 17, - "column": 17, - "offset": 342 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Pay attention to the verb in the sentence.", - "position": { - "start": { - "line": 19, - "column": 1, - "offset": 344 - }, - "end": { - "line": 19, - "column": 43, - "offset": 386 - } - } - } - ], - "position": { - "start": { - "line": 19, - "column": 1, - "offset": 344 - }, - "end": { - "line": 19, - "column": 43, - "offset": 386 - } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { - "line": 21, - "column": 1, - "offset": 388 - }, - "end": { - "line": 21, - "column": 4, - "offset": 391 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "right", - "position": { - "start": { - "line": 23, - "column": 1, - "offset": 393 - }, - "end": { - "line": 23, - "column": 8, - "offset": 400 - } - } - } - ], - "position": { - "start": { - "line": 23, - "column": 1, - "offset": 393 - }, - "end": { - "line": 23, - "column": 8, - "offset": 400 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 25, - "column": 5, - "offset": 406 - }, - "end": { - "line": 25, - "column": 17, - "offset": 418 - } - } - } - ], - "position": { - "start": { - "line": 25, - "column": 1, - "offset": 402 - }, - "end": { - "line": 25, - "column": 17, - "offset": 418 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Pay attention to the verb in the sentence.", - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 420 - }, - "end": { - "line": 27, - "column": 43, - "offset": 462 - } - } - } - ], - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 420 - }, - "end": { - "line": 27, - "column": 43, - "offset": 462 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 28, - "column": 1, - "offset": 463 - } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank.json b/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank.json deleted file mode 100644 index 0a8987bf590..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-fill-in-the-blank.json +++ /dev/null @@ -1,755 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { - "line": 1, - "column": 3, - "offset": 2 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 18, - "offset": 17 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In English, when making introductions or identifying someone, you use the verb ", - "position": { - "start": { - "line": 3, - "column": 1, - "offset": 19 - }, - "end": { - "line": 3, - "column": 80, - "offset": 98 - } - } - }, - { - "type": "inlineCode", - "value": "to be", - "position": { - "start": { - "line": 3, - "column": 80, - "offset": 98 - }, - "end": { - "line": 3, - "column": 87, - "offset": 105 - } - } - }, - { - "type": "text", - "value": ". In this case, ", - "position": { - "start": { - "line": 3, - "column": 87, - "offset": 105 - }, - "end": { - "line": 3, - "column": 103, - "offset": 121 - } - } - }, - { - "type": "inlineCode", - "value": "You are", - "position": { - "start": { - "line": 3, - "column": 103, - "offset": 121 - }, - "end": { - "line": 3, - "column": 112, - "offset": 130 - } - } - }, - { - "type": "text", - "value": " is used to address the person Maria is talking to and affirmatively identify their occupation.", - "position": { - "start": { - "line": 3, - "column": 112, - "offset": 130 - }, - "end": { - "line": 3, - "column": 207, - "offset": 225 - } - } - } - ], - "position": { - "start": { - "line": 3, - "column": 1, - "offset": 19 - }, - "end": { - "line": 3, - "column": 207, - "offset": 225 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Maria is introducing herself and confirming Tom's job role. ", - "position": { - "start": { - "line": 5, - "column": 1, - "offset": 227 - }, - "end": { - "line": 5, - "column": 61, - "offset": 287 - } - } - }, - { - "type": "inlineCode", - "value": "Are", - "position": { - "start": { - "line": 5, - "column": 61, - "offset": 287 - }, - "end": { - "line": 5, - "column": 66, - "offset": 292 - } - } - }, - { - "type": "text", - "value": " is used in the present affirmative to make a statement.", - "position": { - "start": { - "line": 5, - "column": 66, - "offset": 292 - }, - "end": { - "line": 5, - "column": 122, - "offset": 348 - } - } - } - ], - "position": { - "start": { - "line": 5, - "column": 1, - "offset": 227 - }, - "end": { - "line": 5, - "column": 122, - "offset": 348 - } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--fillInTheBlank--", - "position": { - "start": { - "line": 7, - "column": 3, - "offset": 352 - }, - "end": { - "line": 7, - "column": 21, - "offset": 370 - } - } - } - ], - "position": { - "start": { - "line": 7, - "column": 1, - "offset": 350 - }, - "end": { - "line": 7, - "column": 21, - "offset": 370 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--sentence--", - "position": { - "start": { - "line": 9, - "column": 4, - "offset": 375 - }, - "end": { - "line": 9, - "column": 16, - "offset": 387 - } - } - } - ], - "position": { - "start": { - "line": 9, - "column": 1, - "offset": 372 - }, - "end": { - "line": 9, - "column": 16, - "offset": 387 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Hello, You BLANK the new graphic designer, BLANK? BLANK to meet you!", - "position": { - "start": { - "line": 11, - "column": 1, - "offset": 389 - }, - "end": { - "line": 11, - "column": 59, - "offset": 447 - } - } - } - ], - "position": { - "start": { - "line": 11, - "column": 1, - "offset": 389 - }, - "end": { - "line": 11, - "column": 59, - "offset": 447 - } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--blanks--", - "position": { - "start": { - "line": 13, - "column": 4, - "offset": 452 - }, - "end": { - "line": 13, - "column": 14, - "offset": 462 - } - } - } - ], - "position": { - "start": { - "line": 13, - "column": 1, - "offset": 449 - }, - "end": { - "line": 13, - "column": 14, - "offset": 462 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "are", - "position": { - "start": { - "line": 15, - "column": 1, - "offset": 464 - }, - "end": { - "line": 15, - "column": 6, - "offset": 469 - } - } - } - ], - "position": { - "start": { - "line": 15, - "column": 1, - "offset": 464 - }, - "end": { - "line": 15, - "column": 6, - "offset": 469 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 17, - "column": 5, - "offset": 475 - }, - "end": { - "line": 17, - "column": 17, - "offset": 487 - } - } - } - ], - "position": { - "start": { - "line": 17, - "column": 1, - "offset": 471 - }, - "end": { - "line": 17, - "column": 17, - "offset": 487 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The verb ", - "position": { - "start": { - "line": 19, - "column": 1, - "offset": 489 - }, - "end": { - "line": 19, - "column": 10, - "offset": 498 - } - } - }, - { - "type": "inlineCode", - "value": "to be", - "position": { - "start": { - "line": 19, - "column": 10, - "offset": 498 - }, - "end": { - "line": 19, - "column": 17, - "offset": 505 - } - } - }, - { - "type": "text", - "value": " is an irregular verb. When conjugated with the pronoun ", - "position": { - "start": { - "line": 19, - "column": 17, - "offset": 505 - }, - "end": { - "line": 19, - "column": 73, - "offset": 561 - } - } - }, - { - "type": "inlineCode", - "value": "you", - "position": { - "start": { - "line": 19, - "column": 73, - "offset": 561 - }, - "end": { - "line": 19, - "column": 78, - "offset": 566 - } - } - }, - { - "type": "text", - "value": ", ", - "position": { - "start": { - "line": 19, - "column": 78, - "offset": 566 - }, - "end": { - "line": 19, - "column": 80, - "offset": 568 - } - } - }, - { - "type": "inlineCode", - "value": "be", - "position": { - "start": { - "line": 19, - "column": 80, - "offset": 568 - }, - "end": { - "line": 19, - "column": 84, - "offset": 572 - } - } - }, - { - "type": "text", - "value": " becomes ", - "position": { - "start": { - "line": 19, - "column": 84, - "offset": 572 - }, - "end": { - "line": 19, - "column": 93, - "offset": 581 - } - } - }, - { - "type": "inlineCode", - "value": "are", - "position": { - "start": { - "line": 19, - "column": 93, - "offset": 581 - }, - "end": { - "line": 19, - "column": 98, - "offset": 586 - } - } - }, - { - "type": "text", - "value": ". For example: ", - "position": { - "start": { - "line": 19, - "column": 98, - "offset": 586 - }, - "end": { - "line": 19, - "column": 113, - "offset": 601 - } - } - }, - { - "type": "inlineCode", - "value": "You are an English learner.", - "position": { - "start": { - "line": 19, - "column": 113, - "offset": 601 - }, - "end": { - "line": 19, - "column": 142, - "offset": 630 - } - } - } - ], - "position": { - "start": { - "line": 19, - "column": 1, - "offset": 489 - }, - "end": { - "line": 19, - "column": 142, - "offset": 630 - } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { - "line": 21, - "column": 1, - "offset": 632 - }, - "end": { - "line": 21, - "column": 4, - "offset": 635 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "right", - "position": { - "start": { - "line": 23, - "column": 1, - "offset": 637 - }, - "end": { - "line": 23, - "column": 8, - "offset": 644 - } - } - } - ], - "position": { - "start": { - "line": 23, - "column": 1, - "offset": 637 - }, - "end": { - "line": 23, - "column": 8, - "offset": 644 - } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { - "line": 25, - "column": 5, - "offset": 650 - }, - "end": { - "line": 25, - "column": 17, - "offset": 662 - } - } - } - ], - "position": { - "start": { - "line": 25, - "column": 1, - "offset": 646 - }, - "end": { - "line": 25, - "column": 17, - "offset": 662 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Feedback 2", - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 664 - }, - "end": { - "line": 27, - "column": 11, - "offset": 674 - } - } - } - ], - "position": { - "start": { - "line": 27, - "column": 1, - "offset": 664 - }, - "end": { - "line": 27, - "column": 11, - "offset": 674 - } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { - "line": 29, - "column": 1, - "offset": 676 - }, - "end": { - "line": 29, - "column": 4, - "offset": 679 - } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "Nice", - "position": { - "start": { - "line": 31, - "column": 1, - "offset": 681 - }, - "end": { - "line": 31, - "column": 7, - "offset": 687 - } - } - } - ], - "position": { - "start": { - "line": 31, - "column": 1, - "offset": 681 - }, - "end": { - "line": 31, - "column": 7, - "offset": 687 - } - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 31, - "column": 7, - "offset": 687 - } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-gfm.json b/tools/challenge-parser/parser/__fixtures__/ast-gfm.json deleted file mode 100644 index ae73750fd08..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-gfm.json +++ /dev/null @@ -1,437 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1 ~~Strikethrough text~~.", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 36, "offset": 54 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 36, "offset": 54 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 56 }, - "end": { "line": 7, "column": 4, "offset": 80 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "| example | of a |\n| --- | --- |\n| gfm | table |", - "position": { - "start": { "line": 9, "column": 1, "offset": 82 }, - "end": { "line": 11, "column": 16, "offset": 130 } - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 82 }, - "end": { "line": 11, "column": 16, "offset": 130 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 14, "column": 3, "offset": 135 }, - "end": { "line": 14, "column": 19, "offset": 151 } - } - } - ], - "position": { - "start": { "line": 14, "column": 1, "offset": 133 }, - "end": { "line": 14, "column": 19, "offset": 151 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 16, "column": 1, "offset": 153 }, - "end": { "line": 16, "column": 12, "offset": 164 } - } - } - ], - "position": { - "start": { "line": 16, "column": 1, "offset": 153 }, - "end": { "line": 16, "column": 12, "offset": 164 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 18, "column": 1, "offset": 166 }, - "end": { "line": 20, "column": 4, "offset": 192 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 22, "column": 3, "offset": 196 }, - "end": { "line": 22, "column": 12, "offset": 205 } - } - } - ], - "position": { - "start": { "line": 22, "column": 1, "offset": 194 }, - "end": { "line": 22, "column": 12, "offset": 205 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 24, "column": 1, "offset": 207 }, - "end": { "line": 24, "column": 11, "offset": 217 } - } - } - ], - "position": { - "start": { "line": 24, "column": 1, "offset": 207 }, - "end": { "line": 24, "column": 11, "offset": 217 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 26, "column": 1, "offset": 219 }, - "end": { "line": 28, "column": 4, "offset": 241 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 30, "column": 1, "offset": 243 }, - "end": { "line": 30, "column": 18, "offset": 260 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 30, "column": 18, "offset": 260 }, - "end": { "line": 30, "column": 24, "offset": 266 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 30, "column": 24, "offset": 266 }, - "end": { "line": 30, "column": 28, "offset": 270 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 30, "column": 28, "offset": 270 }, - "end": { "line": 30, "column": 35, "offset": 277 } - } - } - ], - "position": { - "start": { "line": 30, "column": 1, "offset": 243 }, - "end": { "line": 30, "column": 35, "offset": 277 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 32, "column": 1, "offset": 279 }, - "end": { "line": 34, "column": 4, "offset": 306 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Third ", - "position": { - "start": { "line": 36, "column": 1, "offset": 308 }, - "end": { "line": 36, "column": 7, "offset": 314 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "hint", - "position": { - "start": { "line": 36, "column": 8, "offset": 315 }, - "end": { "line": 36, "column": 12, "offset": 319 } - } - } - ], - "position": { - "start": { "line": 36, "column": 7, "offset": 314 }, - "end": { "line": 36, "column": 13, "offset": 320 } - } - }, - { - "type": "text", - "value": " with ", - "position": { - "start": { "line": 36, "column": 13, "offset": 320 }, - "end": { "line": 36, "column": 19, "offset": 326 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 36, "column": 19, "offset": 326 }, - "end": { "line": 36, "column": 25, "offset": 332 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 36, "column": 25, "offset": 332 }, - "end": { "line": 36, "column": 29, "offset": 336 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 36, "column": 29, "offset": 336 }, - "end": { "line": 36, "column": 36, "offset": 343 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 36, "column": 36, "offset": 343 }, - "end": { "line": 36, "column": 41, "offset": 348 } - } - }, - { - "type": "inlineCode", - "value": "inline code", - "position": { - "start": { "line": 36, "column": 41, "offset": 348 }, - "end": { "line": 36, "column": 54, "offset": 361 } - } - } - ], - "position": { - "start": { "line": 36, "column": 1, "offset": 308 }, - "end": { "line": 36, "column": 54, "offset": 361 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code\nif(let x of xs) {\n console.log(x);\n}", - "position": { - "start": { "line": 38, "column": 1, "offset": 363 }, - "end": { "line": 43, "column": 4, "offset": 428 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 45, "column": 3, "offset": 432 }, - "end": { "line": 45, "column": 11, "offset": 440 } - } - } - ], - "position": { - "start": { "line": 45, "column": 1, "offset": 430 }, - "end": { "line": 45, "column": 11, "offset": 440 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 47, "column": 4, "offset": 445 }, - "end": { "line": 47, "column": 21, "offset": 462 } - } - } - ], - "position": { - "start": { "line": 47, "column": 1, "offset": 442 }, - "end": { "line": 47, "column": 21, "offset": 462 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 49, "column": 1, "offset": 464 }, - "end": { "line": 54, "column": 4, "offset": 509 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 56, "column": 1, "offset": 511 }, - "end": { "line": 60, "column": 4, "offset": 551 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 62, "column": 1, "offset": 553 }, - "end": { "line": 64, "column": 4, "offset": 575 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 67, "column": 3, "offset": 580 }, - "end": { "line": 67, "column": 16, "offset": 593 } - } - } - ], - "position": { - "start": { "line": 67, "column": 1, "offset": 578 }, - "end": { "line": 67, "column": 16, "offset": 593 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "image", - "title": null, - "url": "", - "alt": "html-key", - "position": { - "start": { "line": 69, "column": 1, "offset": 595 }, - "end": { "line": 69, "column": 14, "offset": 608 } - } - } - ], - "position": { - "start": { "line": 69, "column": 1, "offset": 595 }, - "end": { "line": 69, "column": 14, "offset": 608 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 71, "column": 1, "offset": 610 }, - "end": { "line": 76, "column": 4, "offset": 655 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 78, "column": 1, "offset": 657 }, - "end": { "line": 82, "column": 4, "offset": 697 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';\n``", - "position": { - "start": { "line": 84, "column": 1, "offset": 699 }, - "end": { "line": 87, "column": 1, "offset": 721 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 87, "column": 1, "offset": 721 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-imports-extra.json b/tools/challenge-parser/parser/__fixtures__/ast-imports-extra.json deleted file mode 100644 index d37e08b01cb..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-imports-extra.json +++ /dev/null @@ -1,321 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "leafDirective", - "name": "import", - "attributes": { "component": "Script", "from": "./script.md" }, - "children": [], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 49, "offset": 48 } - } - }, - { - "type": "leafDirective", - "name": "import", - "attributes": { "component": "Second", "from": "./script-two.md" }, - "children": [], - "position": { - "start": { "line": 2, "column": 1, "offset": 49 }, - "end": { "line": 2, "column": 53, "offset": 101 } - } - }, - { - "type": "leafDirective", - "name": "import", - "attributes": {}, - "children": [], - "position": { - "start": { "line": 3, "column": 1, "offset": 102 }, - "end": { "line": 3, "column": 9, "offset": 110 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 5, "column": 3, "offset": 114 }, - "end": { "line": 5, "column": 18, "offset": 129 } - } - } - ], - "position": { - "start": { "line": 5, "column": 1, "offset": 112 }, - "end": { "line": 5, "column": 18, "offset": 129 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1 ::import", - "position": { - "start": { "line": 7, "column": 1, "offset": 131 }, - "end": { "line": 7, "column": 21, "offset": 151 } - } - } - ], - "position": { - "start": { "line": 7, "column": 1, "offset": 131 }, - "end": { "line": 7, "column": 21, "offset": 151 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 9, "column": 1, "offset": 153 }, - "end": { "line": 11, "column": 4, "offset": 177 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 13, "column": 3, "offset": 181 }, - "end": { "line": 13, "column": 19, "offset": 197 } - } - } - ], - "position": { - "start": { "line": 13, "column": 1, "offset": 179 }, - "end": { "line": 13, "column": 19, "offset": 197 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 15, "column": 1, "offset": 199 }, - "end": { "line": 15, "column": 12, "offset": 210 } - } - } - ], - "position": { - "start": { "line": 15, "column": 1, "offset": 199 }, - "end": { "line": 15, "column": 12, "offset": 210 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 17, "column": 1, "offset": 212 }, - "end": { "line": 19, "column": 4, "offset": 238 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 21, "column": 3, "offset": 242 }, - "end": { "line": 21, "column": 12, "offset": 251 } - } - } - ], - "position": { - "start": { "line": 21, "column": 1, "offset": 240 }, - "end": { "line": 21, "column": 12, "offset": 251 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 23, "column": 1, "offset": 253 }, - "end": { "line": 23, "column": 11, "offset": 263 } - } - } - ], - "position": { - "start": { "line": 23, "column": 1, "offset": 253 }, - "end": { "line": 23, "column": 11, "offset": 263 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 25, "column": 1, "offset": 265 }, - "end": { "line": 27, "column": 4, "offset": 287 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 29, "column": 1, "offset": 289 }, - "end": { "line": 29, "column": 18, "offset": 306 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 29, "column": 18, "offset": 306 }, - "end": { "line": 29, "column": 24, "offset": 312 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 29, "column": 24, "offset": 312 }, - "end": { "line": 29, "column": 28, "offset": 316 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 29, "column": 28, "offset": 316 }, - "end": { "line": 29, "column": 35, "offset": 323 } - } - } - ], - "position": { - "start": { "line": 29, "column": 1, "offset": 289 }, - "end": { "line": 29, "column": 35, "offset": 323 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 31, "column": 1, "offset": 325 }, - "end": { "line": 33, "column": 4, "offset": 352 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 36, "column": 3, "offset": 357 }, - "end": { "line": 36, "column": 11, "offset": 365 } - } - } - ], - "position": { - "start": { "line": 36, "column": 1, "offset": 355 }, - "end": { "line": 36, "column": 11, "offset": 365 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 38, "column": 4, "offset": 370 }, - "end": { "line": 38, "column": 21, "offset": 387 } - } - } - ], - "position": { - "start": { "line": 38, "column": 1, "offset": 367 }, - "end": { "line": 38, "column": 21, "offset": 387 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 40, "column": 1, "offset": 389 }, - "end": { "line": 45, "column": 4, "offset": 434 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 47, "column": 1, "offset": 436 }, - "end": { "line": 51, "column": 4, "offset": 476 } - } - }, - { - "type": "leafDirective", - "name": "use", - "attributes": { "component": "Second" }, - "children": [], - "position": { - "start": { "line": 53, "column": 1, "offset": 478 }, - "end": { "line": 53, "column": 26, "offset": 503 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "custom-name" }, - "children": [], - "position": { - "start": { "line": 55, "column": 1, "offset": 505 }, - "end": { "line": 55, "column": 19, "offset": 523 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 57, "column": 1, "offset": 525 }, - "end": { "line": 59, "column": 4, "offset": 547 } - } - }, - { - "type": "leafDirective", - "name": "use", - "attributes": { "component": "Script" }, - "children": [], - "position": { - "start": { "line": 61, "column": 1, "offset": 549 }, - "end": { "line": 61, "column": 26, "offset": 574 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 62, "column": 1, "offset": 575 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-imports-two.json b/tools/challenge-parser/parser/__fixtures__/ast-imports-two.json deleted file mode 100644 index 90e7095b93c..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-imports-two.json +++ /dev/null @@ -1,320 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "leafDirective", - "name": "import", - "attributes": { "component": "Script", "from": "./script.md" }, - "children": [], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 50, "offset": 49 } - } - }, - { - "type": "leafDirective", - "name": "import", - "attributes": { "component": "Second", "from": "./script-two.md" }, - "children": [], - "position": { - "start": { "line": 2, "column": 1, "offset": 50 }, - "end": { "line": 2, "column": 54, "offset": 103 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 4, "column": 3, "offset": 107 }, - "end": { "line": 4, "column": 18, "offset": 122 } - } - } - ], - "position": { - "start": { "line": 4, "column": 1, "offset": 105 }, - "end": { "line": 4, "column": 18, "offset": 122 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 6, "column": 1, "offset": 124 }, - "end": { "line": 6, "column": 12, "offset": 135 } - } - } - ], - "position": { - "start": { "line": 6, "column": 1, "offset": 124 }, - "end": { "line": 6, "column": 12, "offset": 135 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 8, "column": 1, "offset": 137 }, - "end": { "line": 10, "column": 4, "offset": 161 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 12, "column": 3, "offset": 165 }, - "end": { "line": 12, "column": 19, "offset": 181 } - } - } - ], - "position": { - "start": { "line": 12, "column": 1, "offset": 163 }, - "end": { "line": 12, "column": 19, "offset": 181 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 14, "column": 1, "offset": 183 }, - "end": { "line": 14, "column": 12, "offset": 194 } - } - } - ], - "position": { - "start": { "line": 14, "column": 1, "offset": 183 }, - "end": { "line": 14, "column": 12, "offset": 194 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 16, "column": 1, "offset": 196 }, - "end": { "line": 18, "column": 4, "offset": 222 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 20, "column": 3, "offset": 226 }, - "end": { "line": 20, "column": 12, "offset": 235 } - } - } - ], - "position": { - "start": { "line": 20, "column": 1, "offset": 224 }, - "end": { "line": 20, "column": 12, "offset": 235 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 22, "column": 1, "offset": 237 }, - "end": { "line": 22, "column": 11, "offset": 247 } - } - } - ], - "position": { - "start": { "line": 22, "column": 1, "offset": 237 }, - "end": { "line": 22, "column": 11, "offset": 247 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 24, "column": 1, "offset": 249 }, - "end": { "line": 26, "column": 4, "offset": 271 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 28, "column": 1, "offset": 273 }, - "end": { "line": 28, "column": 18, "offset": 290 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 28, "column": 18, "offset": 290 }, - "end": { "line": 28, "column": 24, "offset": 296 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 28, "column": 24, "offset": 296 }, - "end": { "line": 28, "column": 28, "offset": 300 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 28, "column": 28, "offset": 300 }, - "end": { "line": 28, "column": 35, "offset": 307 } - } - } - ], - "position": { - "start": { "line": 28, "column": 1, "offset": 273 }, - "end": { "line": 28, "column": 35, "offset": 307 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 30, "column": 1, "offset": 309 }, - "end": { "line": 32, "column": 4, "offset": 336 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 35, "column": 3, "offset": 341 }, - "end": { "line": 35, "column": 11, "offset": 349 } - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 339 }, - "end": { "line": 35, "column": 11, "offset": 349 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 37, "column": 4, "offset": 354 }, - "end": { "line": 37, "column": 21, "offset": 371 } - } - } - ], - "position": { - "start": { "line": 37, "column": 1, "offset": 351 }, - "end": { "line": 37, "column": 21, "offset": 371 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 39, "column": 1, "offset": 373 }, - "end": { "line": 44, "column": 4, "offset": 418 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 46, "column": 1, "offset": 420 }, - "end": { "line": 50, "column": 4, "offset": 460 } - } - }, - { - "type": "leafDirective", - "name": "use", - "attributes": { "component": "Second" }, - "children": [], - "position": { - "start": { "line": 52, "column": 1, "offset": 462 }, - "end": { "line": 52, "column": 26, "offset": 487 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "image", - "title": null, - "url": "", - "alt": "custom-name", - "position": { - "start": { "line": 54, "column": 1, "offset": 489 }, - "end": { "line": 54, "column": 17, "offset": 505 } - } - } - ], - "position": { - "start": { "line": 54, "column": 1, "offset": 489 }, - "end": { "line": 54, "column": 17, "offset": 505 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 56, "column": 1, "offset": 507 }, - "end": { "line": 58, "column": 4, "offset": 529 } - } - }, - { - "type": "leafDirective", - "name": "use", - "attributes": { "component": "Script" }, - "children": [], - "position": { - "start": { "line": 60, "column": 1, "offset": 531 }, - "end": { "line": 60, "column": 26, "offset": 556 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 61, "column": 1, "offset": 557 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-imports.json b/tools/challenge-parser/parser/__fixtures__/ast-imports.json deleted file mode 100644 index ea13152463b..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-imports.json +++ /dev/null @@ -1,300 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "leafDirective", - "name": "import", - "attributes": { "component": "Script", "from": "./script.md" }, - "children": [], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 50, "offset": 49 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 3, "column": 3, "offset": 53 }, - "end": { "line": 3, "column": 18, "offset": 68 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 51 }, - "end": { "line": 3, "column": 18, "offset": 68 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 5, "column": 1, "offset": 70 }, - "end": { "line": 5, "column": 12, "offset": 81 } - } - } - ], - "position": { - "start": { "line": 5, "column": 1, "offset": 70 }, - "end": { "line": 5, "column": 12, "offset": 81 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 7, "column": 1, "offset": 83 }, - "end": { "line": 9, "column": 4, "offset": 107 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 11, "column": 3, "offset": 111 }, - "end": { "line": 11, "column": 19, "offset": 127 } - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 109 }, - "end": { "line": 11, "column": 19, "offset": 127 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 129 }, - "end": { "line": 13, "column": 12, "offset": 140 } - } - } - ], - "position": { - "start": { "line": 13, "column": 1, "offset": 129 }, - "end": { "line": 13, "column": 12, "offset": 140 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 15, "column": 1, "offset": 142 }, - "end": { "line": 17, "column": 4, "offset": 168 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 19, "column": 3, "offset": 172 }, - "end": { "line": 19, "column": 12, "offset": 181 } - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 170 }, - "end": { "line": 19, "column": 12, "offset": 181 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 21, "column": 1, "offset": 183 }, - "end": { "line": 21, "column": 11, "offset": 193 } - } - } - ], - "position": { - "start": { "line": 21, "column": 1, "offset": 183 }, - "end": { "line": 21, "column": 11, "offset": 193 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 23, "column": 1, "offset": 195 }, - "end": { "line": 25, "column": 4, "offset": 217 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 27, "column": 1, "offset": 219 }, - "end": { "line": 27, "column": 18, "offset": 236 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 27, "column": 18, "offset": 236 }, - "end": { "line": 27, "column": 24, "offset": 242 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 27, "column": 24, "offset": 242 }, - "end": { "line": 27, "column": 28, "offset": 246 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 27, "column": 28, "offset": 246 }, - "end": { "line": 27, "column": 35, "offset": 253 } - } - } - ], - "position": { - "start": { "line": 27, "column": 1, "offset": 219 }, - "end": { "line": 27, "column": 35, "offset": 253 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 29, "column": 1, "offset": 255 }, - "end": { "line": 31, "column": 4, "offset": 282 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 34, "column": 3, "offset": 287 }, - "end": { "line": 34, "column": 11, "offset": 295 } - } - } - ], - "position": { - "start": { "line": 34, "column": 1, "offset": 285 }, - "end": { "line": 34, "column": 11, "offset": 295 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 36, "column": 4, "offset": 300 }, - "end": { "line": 36, "column": 21, "offset": 317 } - } - } - ], - "position": { - "start": { "line": 36, "column": 1, "offset": 297 }, - "end": { "line": 36, "column": 21, "offset": 317 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 38, "column": 1, "offset": 319 }, - "end": { "line": 43, "column": 4, "offset": 364 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 45, "column": 1, "offset": 366 }, - "end": { "line": 49, "column": 4, "offset": 406 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "image", - "title": null, - "url": "", - "alt": "custom-name", - "position": { - "start": { "line": 51, "column": 1, "offset": 408 }, - "end": { "line": 51, "column": 17, "offset": 424 } - } - } - ], - "position": { - "start": { "line": 51, "column": 1, "offset": 408 }, - "end": { "line": 51, "column": 17, "offset": 424 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 53, "column": 1, "offset": 426 }, - "end": { "line": 55, "column": 4, "offset": 448 } - } - }, - { - "type": "leafDirective", - "name": "use", - "attributes": { "component": "Script" }, - "children": [], - "position": { - "start": { "line": 57, "column": 1, "offset": 450 }, - "end": { "line": 57, "column": 26, "offset": 475 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 58, "column": 1, "offset": 476 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-incorrect-markers.json b/tools/challenge-parser/parser/__fixtures__/ast-incorrect-markers.json deleted file mode 100644 index e8937d5eb65..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-incorrect-markers.json +++ /dev/null @@ -1,388 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--step-description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 23, "offset": 22 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 23, "offset": 22 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 24 }, - "end": { "line": 3, "column": 12, "offset": 35 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 24 }, - "end": { "line": 3, "column": 12, "offset": 35 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 37 }, - "end": { "line": 7, "column": 4, "offset": 61 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--step-instructions--", - "position": { - "start": { "line": 9, "column": 3, "offset": 65 }, - "end": { "line": 9, "column": 24, "offset": 86 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 63 }, - "end": { "line": 9, "column": 24, "offset": 86 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 11, "column": 1, "offset": 88 }, - "end": { "line": 11, "column": 12, "offset": 99 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 88 }, - "end": { "line": 11, "column": 12, "offset": 99 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 101 }, - "end": { "line": 15, "column": 4, "offset": 127 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--step-hints--", - "position": { - "start": { "line": 17, "column": 3, "offset": 131 }, - "end": { "line": 17, "column": 17, "offset": 145 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 17, "column": 1, "offset": 129 }, - "end": { "line": 17, "column": 17, "offset": 145 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-1", - "label": "test-id-1", - "referenceType": "shortcut", - "alt": "test-id-1", - "position": { - "start": { "line": 19, "column": 1, "offset": 147 }, - "end": { "line": 19, "column": 13, "offset": 159 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 147 }, - "end": { "line": 19, "column": 13, "offset": 159 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 21, "column": 1, "offset": 161 }, - "end": { "line": 21, "column": 11, "offset": 171 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 21, "column": 1, "offset": 161 }, - "end": { "line": 21, "column": 11, "offset": 171 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 23, "column": 1, "offset": 173 }, - "end": { "line": 25, "column": 4, "offset": 195 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-2", - "label": "test-id-2", - "referenceType": "shortcut", - "alt": "test-id-2", - "position": { - "start": { "line": 27, "column": 1, "offset": 197 }, - "end": { "line": 27, "column": 13, "offset": 209 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 27, "column": 1, "offset": 197 }, - "end": { "line": 27, "column": 13, "offset": 209 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 29, "column": 1, "offset": 211 }, - "end": { "line": 29, "column": 18, "offset": 228 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 29, "column": 18, "offset": 228 }, - "end": { "line": 29, "column": 24, "offset": 234 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 29, "column": 24, "offset": 234 }, - "end": { "line": 29, "column": 28, "offset": 238 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 29, "column": 28, "offset": 238 }, - "end": { "line": 29, "column": 35, "offset": 245 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 29, "column": 1, "offset": 211 }, - "end": { "line": 29, "column": 35, "offset": 245 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 31, "column": 1, "offset": 247 }, - "end": { "line": 33, "column": 4, "offset": 274 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--step-seed--", - "position": { - "start": { "line": 35, "column": 3, "offset": 278 }, - "end": { "line": 35, "column": 16, "offset": 291 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 276 }, - "end": { "line": 35, "column": 16, "offset": 291 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 37, "column": 1, "offset": 293 }, - "end": { "line": 42, "column": 4, "offset": 338 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 44, "column": 1, "offset": 340 }, - "end": { "line": 48, "column": 4, "offset": 380 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 50, "column": 1, "offset": 382 }, - "end": { "line": 52, "column": 4, "offset": 404 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solution-marker--", - "position": { - "start": { "line": 55, "column": 3, "offset": 409 }, - "end": { "line": 55, "column": 22, "offset": 428 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 55, "column": 1, "offset": 407 }, - "end": { "line": 55, "column": 22, "offset": 428 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 57, "column": 1, "offset": 430 }, - "end": { "line": 57, "column": 12, "offset": 441 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 57, "column": 1, "offset": 430 }, - "end": { "line": 57, "column": 12, "offset": 441 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 59, "column": 1, "offset": 443 }, - "end": { "line": 64, "column": 4, "offset": 488 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 66, "column": 1, "offset": 490 }, - "end": { "line": 70, "column": 4, "offset": 530 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';\n``\n", - "position": { - "start": { "line": 72, "column": 1, "offset": 532 }, - "end": { "line": 75, "column": 1, "offset": 554 }, - "indent": [1, 1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 75, "column": 1, "offset": 554 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-jsx-seed.json b/tools/challenge-parser/parser/__fixtures__/ast-jsx-seed.json deleted file mode 100644 index af5e3ea34fe..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-jsx-seed.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 24, "offset": 35 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "jsx", - "meta": null, - "value": "function setup() {}", - "position": { - "start": { "line": 5, "column": 1, "offset": 37 }, - "end": { "line": 7, "column": 4, "offset": 67 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 9, "column": 4, "offset": 72 }, - "end": { "line": 9, "column": 21, "offset": 89 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 69 }, - "end": { "line": 9, "column": 21, "offset": 89 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "jsx", - "meta": null, - "value": "var x = 'y';\n\n/* comment */\nconst Button = () => {\n return ;\n};", - "position": { - "start": { "line": 11, "column": 1, "offset": 91 }, - "end": { "line": 18, "column": 4, "offset": 214 }, - "indent": [1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--after-user-code--", - "position": { - "start": { "line": 20, "column": 4, "offset": 219 }, - "end": { "line": 20, "column": 23, "offset": 238 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 20, "column": 1, "offset": 216 }, - "end": { "line": 20, "column": 23, "offset": 238 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "jsx", - "meta": null, - "value": "function teardown(params) {\n // after\n}", - "position": { - "start": { "line": 22, "column": 1, "offset": 240 }, - "end": { "line": 26, "column": 4, "offset": 291 }, - "indent": [1, 1, 1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 27, "column": 1, "offset": 292 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-marker-imports.json b/tools/challenge-parser/parser/__fixtures__/ast-marker-imports.json deleted file mode 100644 index 5da04c4caa1..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-marker-imports.json +++ /dev/null @@ -1,303 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "leafDirective", - "name": "import", - "attributes": { - "component": "Script", - "from": "./script-with-markers.md" - }, - "children": [], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 63, "offset": 62 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 3, "column": 3, "offset": 66 }, - "end": { "line": 3, "column": 18, "offset": 81 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 64 }, - "end": { "line": 3, "column": 18, "offset": 81 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 5, "column": 1, "offset": 83 }, - "end": { "line": 5, "column": 12, "offset": 94 } - } - } - ], - "position": { - "start": { "line": 5, "column": 1, "offset": 83 }, - "end": { "line": 5, "column": 12, "offset": 94 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 7, "column": 1, "offset": 96 }, - "end": { "line": 9, "column": 4, "offset": 120 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 11, "column": 3, "offset": 124 }, - "end": { "line": 11, "column": 19, "offset": 140 } - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 122 }, - "end": { "line": 11, "column": 19, "offset": 140 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 142 }, - "end": { "line": 13, "column": 12, "offset": 153 } - } - } - ], - "position": { - "start": { "line": 13, "column": 1, "offset": 142 }, - "end": { "line": 13, "column": 12, "offset": 153 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 15, "column": 1, "offset": 155 }, - "end": { "line": 17, "column": 4, "offset": 181 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 19, "column": 3, "offset": 185 }, - "end": { "line": 19, "column": 12, "offset": 194 } - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 183 }, - "end": { "line": 19, "column": 12, "offset": 194 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 21, "column": 1, "offset": 196 }, - "end": { "line": 21, "column": 11, "offset": 206 } - } - } - ], - "position": { - "start": { "line": 21, "column": 1, "offset": 196 }, - "end": { "line": 21, "column": 11, "offset": 206 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 23, "column": 1, "offset": 208 }, - "end": { "line": 25, "column": 4, "offset": 230 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 27, "column": 1, "offset": 232 }, - "end": { "line": 27, "column": 18, "offset": 249 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 27, "column": 18, "offset": 249 }, - "end": { "line": 27, "column": 24, "offset": 255 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 27, "column": 24, "offset": 255 }, - "end": { "line": 27, "column": 28, "offset": 259 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 27, "column": 28, "offset": 259 }, - "end": { "line": 27, "column": 35, "offset": 266 } - } - } - ], - "position": { - "start": { "line": 27, "column": 1, "offset": 232 }, - "end": { "line": 27, "column": 35, "offset": 266 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 29, "column": 1, "offset": 268 }, - "end": { "line": 31, "column": 4, "offset": 295 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 34, "column": 3, "offset": 300 }, - "end": { "line": 34, "column": 11, "offset": 308 } - } - } - ], - "position": { - "start": { "line": 34, "column": 1, "offset": 298 }, - "end": { "line": 34, "column": 11, "offset": 308 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 36, "column": 4, "offset": 313 }, - "end": { "line": 36, "column": 21, "offset": 330 } - } - } - ], - "position": { - "start": { "line": 36, "column": 1, "offset": 310 }, - "end": { "line": 36, "column": 21, "offset": 330 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 38, "column": 1, "offset": 332 }, - "end": { "line": 43, "column": 4, "offset": 377 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 45, "column": 1, "offset": 379 }, - "end": { "line": 49, "column": 4, "offset": 419 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "image", - "title": null, - "url": "", - "alt": "custom-name", - "position": { - "start": { "line": 51, "column": 1, "offset": 421 }, - "end": { "line": 51, "column": 17, "offset": 437 } - } - } - ], - "position": { - "start": { "line": 51, "column": 1, "offset": 421 }, - "end": { "line": 51, "column": 17, "offset": 437 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 53, "column": 1, "offset": 439 }, - "end": { "line": 55, "column": 4, "offset": 461 } - } - }, - { - "type": "leafDirective", - "name": "use", - "attributes": { "component": "Script" }, - "children": [], - "position": { - "start": { "line": 57, "column": 1, "offset": 463 }, - "end": { "line": 57, "column": 26, "offset": 488 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 58, "column": 1, "offset": 489 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-md-in-html.json b/tools/challenge-parser/parser/__fixtures__/ast-md-in-html.json deleted file mode 100644 index 3f7326078a0..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-md-in-html.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": " code in code tags *emphasis* followed by
some nested html
", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 98, "offset": 116 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 4, "column": 1, "offset": 117 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-multiple-solutions.json b/tools/challenge-parser/parser/__fixtures__/ast-multiple-solutions.json deleted file mode 100644 index a28821d8dba..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-multiple-solutions.json +++ /dev/null @@ -1,303 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 24, "offset": 35 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 24, "offset": 35 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n etc: ''\n}", - "position": { - "start": { "line": 5, "column": 1, "offset": 37 }, - "end": { "line": 9, "column": 4, "offset": 66 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "", - "position": { - "start": { "line": 11, "column": 1, "offset": 68 }, - "end": { "line": 13, "column": 4, "offset": 96 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 15, "column": 4, "offset": 101 }, - "end": { "line": 15, "column": 21, "offset": 118 } - } - } - ], - "position": { - "start": { "line": 15, "column": 1, "offset": 98 }, - "end": { "line": 15, "column": 21, "offset": 118 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 17, "column": 1, "offset": 120 }, - "end": { "line": 22, "column": 4, "offset": 165 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 24, "column": 1, "offset": 167 }, - "end": { "line": 28, "column": 4, "offset": 207 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 30, "column": 1, "offset": 209 }, - "end": { "line": 32, "column": 4, "offset": 231 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--after-user-code--", - "position": { - "start": { "line": 34, "column": 4, "offset": 236 }, - "end": { "line": 34, "column": 23, "offset": 255 } - } - } - ], - "position": { - "start": { "line": 34, "column": 1, "offset": 233 }, - "end": { "line": 34, "column": 23, "offset": 255 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: blue;\n}", - "position": { - "start": { "line": 36, "column": 1, "offset": 257 }, - "end": { "line": 40, "column": 4, "offset": 296 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "function teardown(params) {\n // after\n}", - "position": { - "start": { "line": 42, "column": 1, "offset": 298 }, - "end": { "line": 46, "column": 4, "offset": 348 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 49, "column": 3, "offset": 353 }, - "end": { "line": 49, "column": 16, "offset": 366 } - } - } - ], - "position": { - "start": { "line": 49, "column": 1, "offset": 351 }, - "end": { "line": 49, "column": 16, "offset": 366 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "html-key" }, - "children": [], - "position": { - "start": { "line": 51, "column": 1, "offset": 368 }, - "end": { "line": 51, "column": 16, "offset": 383 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 53, "column": 1, "offset": 385 }, - "end": { "line": 58, "column": 4, "offset": 430 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 60, "column": 1, "offset": 432 }, - "end": { "line": 64, "column": 4, "offset": 472 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 66, "column": 1, "offset": 474 }, - "end": { "line": 68, "column": 4, "offset": 496 } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { "line": 70, "column": 1, "offset": 498 }, - "end": { "line": 70, "column": 4, "offset": 501 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "html-key" }, - "children": [], - "position": { - "start": { "line": 72, "column": 1, "offset": 503 }, - "end": { "line": 72, "column": 16, "offset": 518 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n solution number two\n \n", - "position": { - "start": { "line": 74, "column": 1, "offset": 520 }, - "end": { "line": 80, "column": 4, "offset": 587 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 82, "column": 1, "offset": 589 }, - "end": { "line": 86, "column": 4, "offset": 629 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 88, "column": 1, "offset": 631 }, - "end": { "line": 90, "column": 4, "offset": 653 } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { "line": 92, "column": 1, "offset": 655 }, - "end": { "line": 92, "column": 4, "offset": 658 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "html-key" }, - "children": [], - "position": { - "start": { "line": 94, "column": 1, "offset": 660 }, - "end": { "line": 94, "column": 16, "offset": 675 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 96, "column": 1, "offset": 677 }, - "end": { "line": 101, "column": 4, "offset": 722 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 103, "column": 1, "offset": 724 }, - "end": { "line": 107, "column": 4, "offset": 764 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y3';", - "position": { - "start": { "line": 109, "column": 1, "offset": 766 }, - "end": { "line": 111, "column": 4, "offset": 789 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 112, "column": 1, "offset": 790 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-orphan-key.json b/tools/challenge-parser/parser/__fixtures__/ast-orphan-key.json deleted file mode 100644 index 3b1ba7961a5..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-orphan-key.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 5, "column": 1, "offset": 34 }, - "end": { "line": 10, "column": 4, "offset": 79 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 12, "column": 1, "offset": 81 }, - "end": { "line": 16, "column": 4, "offset": 121 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "key-for-html" }, - "children": [], - "position": { - "start": { "line": 18, "column": 1, "offset": 123 }, - "end": { "line": 18, "column": 20, "offset": 142 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 19, "column": 1, "offset": 143 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-realistic.json b/tools/challenge-parser/parser/__fixtures__/ast-realistic.json deleted file mode 100644 index 4e58dc94341..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-realistic.json +++ /dev/null @@ -1,1123 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When you add a lower rank heading element to the page, it's implied that you're starting a new subsection.", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 107, "offset": 125 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 107, "offset": 125 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "After the last ", - "position": { - "start": { "line": 5, "column": 1, "offset": 127 }, - "end": { "line": 5, "column": 16, "offset": 142 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5, "column": 16, "offset": 142 }, - "end": { "line": 5, "column": 22, "offset": 148 }, - "indent": [] - } - }, - { - "type": "text", - "value": "h2", - "position": { - "start": { "line": 5, "column": 22, "offset": 148 }, - "end": { "line": 5, "column": 24, "offset": 150 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5, "column": 24, "offset": 150 }, - "end": { "line": 5, "column": 31, "offset": 157 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element of the second ", - "position": { - "start": { "line": 5, "column": 31, "offset": 157 }, - "end": { "line": 5, "column": 54, "offset": 180 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 5, "column": 54, "offset": 180 }, - "end": { "line": 5, "column": 63, "offset": 189 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element, add an ", - "position": { - "start": { "line": 5, "column": 63, "offset": 189 }, - "end": { "line": 5, "column": 80, "offset": 206 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h3", - "position": { - "start": { "line": 5, "column": 80, "offset": 206 }, - "end": { "line": 5, "column": 84, "offset": 210 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element with the text ", - "position": { - "start": { "line": 5, "column": 84, "offset": 210 }, - "end": { "line": 5, "column": 107, "offset": 233 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "Things cats love:", - "position": { - "start": { "line": 5, "column": 107, "offset": 233 }, - "end": { "line": 5, "column": 126, "offset": 252 }, - "indent": [] - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5, "column": 126, "offset": 252 }, - "end": { "line": 5, "column": 127, "offset": 253 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 5, "column": 1, "offset": 127 }, - "end": { "line": 5, "column": 127, "offset": 253 }, - "indent": [] - } - }, - { - "type": "html", - "value": "
\n

Some text in a blockquote

\n

\n Some text in a blockquote, with code\n

\n
", - "position": { - "start": { "line": 7, "column": 1, "offset": 255 }, - "end": { "line": 12, "column": 14, "offset": 383 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 14, "column": 3, "offset": 387 }, - "end": { "line": 14, "column": 19, "offset": 403 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 14, "column": 1, "offset": 385 }, - "end": { "line": 14, "column": 19, "offset": 403 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Do something with the ", - "position": { - "start": { "line": 16, "column": 1, "offset": 405 }, - "end": { "line": 16, "column": 23, "offset": 427 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "code", - "position": { - "start": { "line": 16, "column": 23, "offset": 427 }, - "end": { "line": 16, "column": 29, "offset": 433 }, - "indent": [] - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 16, "column": 29, "offset": 433 }, - "end": { "line": 16, "column": 30, "offset": 434 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 16, "column": 1, "offset": 405 }, - "end": { "line": 16, "column": 30, "offset": 434 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "To test that adjacent tags are handled correctly:", - "position": { - "start": { "line": 18, "column": 1, "offset": 436 }, - "end": { "line": 18, "column": 50, "offset": 485 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 18, "column": 1, "offset": 436 }, - "end": { "line": 18, "column": 50, "offset": 485 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a bit of ", - "position": { - "start": { "line": 20, "column": 1, "offset": 487 }, - "end": { "line": 20, "column": 10, "offset": 496 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 20, "column": 10, "offset": 496 }, - "end": { "line": 20, "column": 16, "offset": 502 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 20, "column": 16, "offset": 502 }, - "end": { "line": 20, "column": 20, "offset": 506 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 20, "column": 20, "offset": 506 }, - "end": { "line": 20, "column": 27, "offset": 513 }, - "indent": [] - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 20, "column": 27, "offset": 513 }, - "end": { "line": 20, "column": 28, "offset": 514 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 20, "column": 28, "offset": 514 }, - "end": { "line": 20, "column": 33, "offset": 519 }, - "indent": [] - } - }, - { - "type": "text", - "value": "with more after a space", - "position": { - "start": { "line": 20, "column": 33, "offset": 519 }, - "end": { "line": 20, "column": 56, "offset": 542 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 20, "column": 56, "offset": 542 }, - "end": { "line": 20, "column": 62, "offset": 548 }, - "indent": [] - } - }, - { - "type": "text", - "value": " and another pair of ", - "position": { - "start": { "line": 20, "column": 62, "offset": 548 }, - "end": { "line": 20, "column": 83, "offset": 569 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 20, "column": 83, "offset": 569 }, - "end": { "line": 20, "column": 91, "offset": 577 }, - "indent": [] - } - }, - { - "type": "text", - "value": "elements", - "position": { - "start": { "line": 20, "column": 91, "offset": 577 }, - "end": { "line": 20, "column": 99, "offset": 585 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 20, "column": 99, "offset": 585 }, - "end": { "line": 20, "column": 108, "offset": 594 }, - "indent": [] - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 20, "column": 108, "offset": 594 }, - "end": { "line": 20, "column": 109, "offset": 595 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 20, "column": 109, "offset": 595 }, - "end": { "line": 20, "column": 113, "offset": 599 }, - "indent": [] - } - }, - { - "type": "text", - "value": "with a space", - "position": { - "start": { "line": 20, "column": 113, "offset": 599 }, - "end": { "line": 20, "column": 125, "offset": 611 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 20, "column": 125, "offset": 611 }, - "end": { "line": 20, "column": 130, "offset": 616 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 20, "column": 1, "offset": 487 }, - "end": { "line": 20, "column": 130, "offset": 616 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 22, "column": 3, "offset": 620 }, - "end": { "line": 22, "column": 12, "offset": 629 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 22, "column": 1, "offset": 618 }, - "end": { "line": 22, "column": 12, "offset": 629 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-1", - "label": "test-id-1", - "referenceType": "shortcut", - "alt": "test-id-1", - "position": { - "start": { "line": 24, "column": 1, "offset": 631 }, - "end": { "line": 24, "column": 13, "offset": 643 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 24, "column": 1, "offset": 631 }, - "end": { "line": 24, "column": 13, "offset": 643 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second ", - "position": { - "start": { "line": 26, "column": 1, "offset": 645 }, - "end": { "line": 26, "column": 12, "offset": 656 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 26, "column": 12, "offset": 656 }, - "end": { "line": 26, "column": 21, "offset": 665 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element appears to be missing or does not have both an opening and closing tag.", - "position": { - "start": { "line": 26, "column": 21, "offset": 665 }, - "end": { "line": 26, "column": 101, "offset": 745 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 26, "column": 1, "offset": 645 }, - "end": { "line": 26, "column": 101, "offset": 745 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "assert(\n document.querySelectorAll('main > section')[1] &&\n code.match(/\\<\\/section>/g).length == 2\n);", - "position": { - "start": { "line": 28, "column": 1, "offset": 747 }, - "end": { "line": 33, "column": 4, "offset": 863 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-2", - "label": "test-id-2", - "referenceType": "shortcut", - "alt": "test-id-2", - "position": { - "start": { "line": 35, "column": 1, "offset": 865 }, - "end": { "line": 35, "column": 13, "offset": 877 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 865 }, - "end": { "line": 35, "column": 13, "offset": 877 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "There should be an ", - "position": { - "start": { "line": 37, "column": 1, "offset": 879 }, - "end": { "line": 37, "column": 20, "offset": 898 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h3", - "position": { - "start": { "line": 37, "column": 20, "offset": 898 }, - "end": { "line": 37, "column": 24, "offset": 902 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element right above the second ", - "position": { - "start": { "line": 37, "column": 24, "offset": 902 }, - "end": { "line": 37, "column": 56, "offset": 934 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 37, "column": 56, "offset": 934 }, - "end": { "line": 37, "column": 65, "offset": 943 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element's closing tag.", - "position": { - "start": { "line": 37, "column": 65, "offset": 943 }, - "end": { "line": 37, "column": 88, "offset": 966 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 1, "offset": 879 }, - "end": { "line": 37, "column": 88, "offset": 966 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "assert(\n document.querySelectorAll('main > section')[1].lastElementChild.nodeName ===\n 'H3'\n);", - "position": { - "start": { "line": 39, "column": 1, "offset": 968 }, - "end": { "line": 44, "column": 4, "offset": 1076 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-3", - "label": "test-id-3", - "referenceType": "shortcut", - "alt": "test-id-3", - "position": { - "start": { "line": 46, "column": 1, "offset": 1078 }, - "end": { "line": 46, "column": 13, "offset": 1090 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 46, "column": 1, "offset": 1078 }, - "end": { "line": 46, "column": 13, "offset": 1090 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 48, "column": 1, "offset": 1092 }, - "end": { "line": 48, "column": 5, "offset": 1096 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h3", - "position": { - "start": { "line": 48, "column": 5, "offset": 1096 }, - "end": { "line": 48, "column": 9, "offset": 1100 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element right above the second ", - "position": { - "start": { "line": 48, "column": 9, "offset": 1100 }, - "end": { "line": 48, "column": 41, "offset": 1132 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 48, "column": 41, "offset": 1132 }, - "end": { "line": 48, "column": 50, "offset": 1141 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element's closing tag should have the text ", - "position": { - "start": { "line": 48, "column": 50, "offset": 1141 }, - "end": { "line": 48, "column": 94, "offset": 1185 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "Things cats love:", - "position": { - "start": { "line": 48, "column": 94, "offset": 1185 }, - "end": { "line": 48, "column": 113, "offset": 1204 }, - "indent": [] - } - }, - { - "type": "text", - "value": ". Make sure to include the colon at the end of the text.", - "position": { - "start": { "line": 48, "column": 113, "offset": 1204 }, - "end": { "line": 48, "column": 169, "offset": 1260 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 48, "column": 1, "offset": 1092 }, - "end": { "line": 48, "column": 169, "offset": 1260 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "assert(\n document\n .querySelectorAll('main > section')[1]\n .lastElementChild.innerText.toLowerCase()\n .replace(/\\s+/g, ' ') === 'things cats love:'\n);", - "position": { - "start": { "line": 50, "column": 1, "offset": 1262 }, - "end": { "line": 57, "column": 4, "offset": 1432 }, - "indent": [1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-4", - "label": "test-id-4", - "referenceType": "shortcut", - "alt": "test-id-4", - "position": { - "start": { "line": 59, "column": 1, "offset": 1434 }, - "end": { "line": 59, "column": 13, "offset": 1446 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 59, "column": 1, "offset": 1434 }, - "end": { "line": 59, "column": 13, "offset": 1446 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "There should be an ", - "position": { - "start": { "line": 61, "column": 1, "offset": 1448 }, - "end": { "line": 61, "column": 20, "offset": 1467 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h2", - "position": { - "start": { "line": 61, "column": 20, "offset": 1467 }, - "end": { "line": 61, "column": 24, "offset": 1471 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element with the text ", - "position": { - "start": { "line": 61, "column": 24, "offset": 1471 }, - "end": { "line": 61, "column": 47, "offset": 1494 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "Cat Lists", - "position": { - "start": { "line": 61, "column": 47, "offset": 1494 }, - "end": { "line": 61, "column": 58, "offset": 1505 }, - "indent": [] - } - }, - { - "type": "text", - "value": " above the last ", - "position": { - "start": { "line": 61, "column": 58, "offset": 1505 }, - "end": { "line": 61, "column": 74, "offset": 1521 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h3", - "position": { - "start": { "line": 61, "column": 74, "offset": 1521 }, - "end": { "line": 61, "column": 78, "offset": 1525 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element that is nested in the last ", - "position": { - "start": { "line": 61, "column": 78, "offset": 1525 }, - "end": { "line": 61, "column": 114, "offset": 1561 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 61, "column": 114, "offset": 1561 }, - "end": { "line": 61, "column": 123, "offset": 1570 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element'. You may have accidentally deleted the ", - "position": { - "start": { "line": 61, "column": 123, "offset": 1570 }, - "end": { "line": 61, "column": 172, "offset": 1619 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h2", - "position": { - "start": { "line": 61, "column": 172, "offset": 1619 }, - "end": { "line": 61, "column": 176, "offset": 1623 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element.", - "position": { - "start": { "line": 61, "column": 176, "offset": 1623 }, - "end": { "line": 61, "column": 185, "offset": 1632 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 61, "column": 1, "offset": 1448 }, - "end": { "line": 61, "column": 185, "offset": 1632 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "const secondSectionLastElemNode = document.querySelectorAll('main > section')[1]\n .lastElementChild;\nassert(\n secondSectionLastElemNode.nodeName === 'H3' &&\n secondSectionLastElemNode.previousElementSibling.innerText\n .toLowerCase()\n .replace(/\\s+/g, ' ') === 'cat lists'\n);", - "position": { - "start": { "line": 63, "column": 1, "offset": 1634 }, - "end": { "line": 72, "column": 4, "offset": 1933 }, - "indent": [1, 1, 1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 74, "column": 3, "offset": 1937 }, - "end": { "line": 74, "column": 11, "offset": 1945 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 74, "column": 1, "offset": 1935 }, - "end": { "line": 74, "column": 11, "offset": 1945 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--before-user-code--", - "position": { - "start": { "line": 76, "column": 4, "offset": 1950 }, - "end": { "line": 76, "column": 24, "offset": 1970 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 76, "column": 1, "offset": 1947 }, - "end": { "line": 76, "column": 24, "offset": 1970 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": " // this runs before the user's code is evaluated.", - "position": { - "start": { "line": 78, "column": 1, "offset": 1972 }, - "end": { "line": 80, "column": 4, "offset": 2033 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 82, "column": 4, "offset": 2038 }, - "end": { "line": 82, "column": 21, "offset": 2055 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 82, "column": 1, "offset": 2035 }, - "end": { "line": 82, "column": 21, "offset": 2055 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 84, "column": 1, "offset": 2057 }, - "end": { "line": 84, "column": 12, "offset": 2068 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 84, "column": 1, "offset": 2057 }, - "end": { "line": 84, "column": 12, "offset": 2068 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n

CatPhotoApp

\n
\n
\n

Cat Photos

\n \n

\n Click here to view more\n cat photos.\n

\n \n
\n --fcc-editable-region--\n
\n

Cat Lists

\n
\n --fcc-editable-region--\n
\n \n", - "position": { - "start": { "line": 86, "column": 1, "offset": 2070 }, - "end": { "line": 114, "column": 4, "offset": 2759 }, - "indent": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}\n\nh1 {\n font-size: 20px;\n}\n--fcc-editable-region--\n\n--fcc-editable-region--\n\na {\n color: green;\n}", - "position": { - "start": { "line": 116, "column": 1, "offset": 2761 }, - "end": { "line": 131, "column": 4, "offset": 2900 }, - "indent": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "final-key", - "label": "final-key", - "referenceType": "shortcut", - "alt": "final-key", - "position": { - "start": { "line": 133, "column": 1, "offset": 2902 }, - "end": { "line": 133, "column": 13, "offset": 2914 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 133, "column": 1, "offset": 2902 }, - "end": { "line": 133, "column": 13, "offset": 2914 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 135, "column": 1, "offset": 2916 }, - "end": { "line": 137, "column": 4, "offset": 2938 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 139, "column": 3, "offset": 2942 }, - "end": { "line": 139, "column": 15, "offset": 2954 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 139, "column": 1, "offset": 2940 }, - "end": { "line": 139, "column": 15, "offset": 2954 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 141, "column": 1, "offset": 2956 }, - "end": { "line": 141, "column": 12, "offset": 2967 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 141, "column": 1, "offset": 2956 }, - "end": { "line": 141, "column": 12, "offset": 2967 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n

CatPhotoApp

\n
\n
\n

Cat Photos

\n \n

\n Click here to view more\n cat photos.\n

\n \n
\n
\n

Cat Lists

\n
\n
\n \n", - "position": { - "start": { "line": 143, "column": 1, "offset": 2969 }, - "end": { "line": 169, "column": 4, "offset": 3598 }, - "indent": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}\n\nh1 {\n font-size: 20px;\n}\n--fcc-editable-region--\n\n--fcc-editable-region--\n\na {\n color: green;\n}", - "position": { - "start": { "line": 171, "column": 1, "offset": 3600 }, - "end": { "line": 186, "column": 4, "offset": 3739 }, - "indent": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "final-key", - "label": "final-key", - "referenceType": "shortcut", - "alt": "final-key", - "position": { - "start": { "line": 188, "column": 1, "offset": 3741 }, - "end": { "line": 188, "column": 13, "offset": 3753 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 188, "column": 1, "offset": 3741 }, - "end": { "line": 188, "column": 13, "offset": 3753 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 190, "column": 1, "offset": 3755 }, - "end": { "line": 192, "column": 4, "offset": 3777 }, - "indent": [1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 193, "column": 1, "offset": 3778 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-seed-keys.json b/tools/challenge-parser/parser/__fixtures__/ast-seed-keys.json deleted file mode 100644 index dfb949a2c46..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-seed-keys.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 5, "column": 1, "offset": 34 }, - "end": { "line": 10, "column": 4, "offset": 79 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "key-for-css" }, - "children": [], - "position": { - "start": { "line": 12, "column": 1, "offset": 81 }, - "end": { "line": 12, "column": 19, "offset": 99 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 14, "column": 1, "offset": 101 }, - "end": { "line": 18, "column": 4, "offset": 141 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "key-for-js" }, - "children": [], - "position": { - "start": { "line": 20, "column": 1, "offset": 143 }, - "end": { "line": 20, "column": 18, "offset": 160 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 22, "column": 1, "offset": 162 }, - "end": { "line": 24, "column": 4, "offset": 184 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 25, "column": 1, "offset": 185 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-simple.json b/tools/challenge-parser/parser/__fixtures__/ast-simple.json deleted file mode 100644 index 31e65607c95..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-simple.json +++ /dev/null @@ -1,411 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 7, "column": 4, "offset": 56 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 9, "column": 3, "offset": 60 }, - "end": { "line": 9, "column": 19, "offset": 76 } - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 58 }, - "end": { "line": 9, "column": 19, "offset": 76 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 } - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 91 }, - "end": { "line": 15, "column": 4, "offset": 117 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 17, "column": 3, "offset": 121 }, - "end": { "line": 17, "column": 12, "offset": 130 } - } - } - ], - "position": { - "start": { "line": 17, "column": 1, "offset": 119 }, - "end": { "line": 17, "column": 12, "offset": 130 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 11, "offset": 142 } - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 11, "offset": 142 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 21, "column": 1, "offset": 144 }, - "end": { "line": 23, "column": 4, "offset": 166 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 25, "column": 1, "offset": 168 }, - "end": { "line": 25, "column": 18, "offset": 185 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 25, "column": 18, "offset": 185 }, - "end": { "line": 25, "column": 24, "offset": 191 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 25, "column": 24, "offset": 191 }, - "end": { "line": 25, "column": 28, "offset": 195 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 25, "column": 28, "offset": 195 }, - "end": { "line": 25, "column": 35, "offset": 202 } - } - } - ], - "position": { - "start": { "line": 25, "column": 1, "offset": 168 }, - "end": { "line": 25, "column": 35, "offset": 202 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 27, "column": 1, "offset": 204 }, - "end": { "line": 29, "column": 4, "offset": 231 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Third ", - "position": { - "start": { "line": 31, "column": 1, "offset": 233 }, - "end": { "line": 31, "column": 7, "offset": 239 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "hint", - "position": { - "start": { "line": 31, "column": 8, "offset": 240 }, - "end": { "line": 31, "column": 12, "offset": 244 } - } - } - ], - "position": { - "start": { "line": 31, "column": 7, "offset": 239 }, - "end": { "line": 31, "column": 13, "offset": 245 } - } - }, - { - "type": "text", - "value": " with ", - "position": { - "start": { "line": 31, "column": 13, "offset": 245 }, - "end": { "line": 31, "column": 19, "offset": 251 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 31, "column": 19, "offset": 251 }, - "end": { "line": 31, "column": 25, "offset": 257 } - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 31, "column": 25, "offset": 257 }, - "end": { "line": 31, "column": 29, "offset": 261 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 31, "column": 29, "offset": 261 }, - "end": { "line": 31, "column": 36, "offset": 268 } - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 31, "column": 36, "offset": 268 }, - "end": { "line": 31, "column": 41, "offset": 273 } - } - }, - { - "type": "inlineCode", - "value": "inline code", - "position": { - "start": { "line": 31, "column": 41, "offset": 273 }, - "end": { "line": 31, "column": 54, "offset": 286 } - } - } - ], - "position": { - "start": { "line": 31, "column": 1, "offset": 233 }, - "end": { "line": 31, "column": 54, "offset": 286 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code\nif(let x of xs) {\n console.log(x);\n}", - "position": { - "start": { "line": 33, "column": 1, "offset": 288 }, - "end": { "line": 38, "column": 4, "offset": 353 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 40, "column": 3, "offset": 357 }, - "end": { "line": 40, "column": 11, "offset": 365 } - } - } - ], - "position": { - "start": { "line": 40, "column": 1, "offset": 355 }, - "end": { "line": 40, "column": 11, "offset": 365 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 42, "column": 4, "offset": 370 }, - "end": { "line": 42, "column": 21, "offset": 387 } - } - } - ], - "position": { - "start": { "line": 42, "column": 1, "offset": 367 }, - "end": { "line": 42, "column": 21, "offset": 387 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 44, "column": 1, "offset": 389 }, - "end": { "line": 49, "column": 4, "offset": 434 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 51, "column": 1, "offset": 436 }, - "end": { "line": 55, "column": 4, "offset": 476 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 57, "column": 1, "offset": 478 }, - "end": { "line": 59, "column": 4, "offset": 500 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 62, "column": 3, "offset": 505 }, - "end": { "line": 62, "column": 16, "offset": 518 } - } - } - ], - "position": { - "start": { "line": 62, "column": 1, "offset": 503 }, - "end": { "line": 62, "column": 16, "offset": 518 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "html-key" }, - "children": [], - "position": { - "start": { "line": 64, "column": 1, "offset": 520 }, - "end": { "line": 64, "column": 16, "offset": 535 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 66, "column": 1, "offset": 537 }, - "end": { "line": 71, "column": 4, "offset": 582 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 73, "column": 1, "offset": 584 }, - "end": { "line": 77, "column": 4, "offset": 624 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';\n``", - "position": { - "start": { "line": 79, "column": 1, "offset": 626 }, - "end": { "line": 82, "column": 1, "offset": 648 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 82, "column": 1, "offset": 648 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-video-challenge.json b/tools/challenge-parser/parser/__fixtures__/ast-video-challenge.json deleted file mode 100644 index 22f980ffadd..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-video-challenge.json +++ /dev/null @@ -1,381 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 7, "column": 4, "offset": 56 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 9, "column": 3, "offset": 60 }, - "end": { "line": 9, "column": 19, "offset": 76 } - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 58 }, - "end": { "line": 9, "column": 19, "offset": 76 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 } - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 91 }, - "end": { "line": 15, "column": 4, "offset": 117 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--questions--", - "position": { - "start": { "line": 17, "column": 3, "offset": 121 }, - "end": { "line": 17, "column": 16, "offset": 134 } - } - } - ], - "position": { - "start": { "line": 17, "column": 1, "offset": 119 }, - "end": { "line": 17, "column": 16, "offset": 134 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--text--", - "position": { - "start": { "line": 19, "column": 4, "offset": 139 }, - "end": { "line": 19, "column": 12, "offset": 147 } - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 136 }, - "end": { "line": 19, "column": 12, "offset": 147 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Question line 1", - "position": { - "start": { "line": 21, "column": 1, "offset": 149 }, - "end": { "line": 21, "column": 16, "offset": 164 } - } - } - ], - "position": { - "start": { "line": 21, "column": 1, "offset": 149 }, - "end": { "line": 21, "column": 16, "offset": 164 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": " var x = 'y';", - "position": { - "start": { "line": 23, "column": 1, "offset": 166 }, - "end": { "line": 25, "column": 4, "offset": 190 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--answers--", - "position": { - "start": { "line": 27, "column": 4, "offset": 195 }, - "end": { "line": 27, "column": 15, "offset": 206 } - } - } - ], - "position": { - "start": { "line": 27, "column": 1, "offset": 192 }, - "end": { "line": 27, "column": 15, "offset": 206 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some inline ", - "position": { - "start": { "line": 29, "column": 1, "offset": 208 }, - "end": { "line": 29, "column": 13, "offset": 220 } - } - }, - { - "type": "inlineCode", - "value": "code", - "position": { - "start": { "line": 29, "column": 13, "offset": 220 }, - "end": { "line": 29, "column": 19, "offset": 226 } - } - } - ], - "position": { - "start": { "line": 29, "column": 1, "offset": 208 }, - "end": { "line": 29, "column": 19, "offset": 226 } - } - }, - { - "type": "heading", - "depth": 3, - "children": [ - { - "type": "text", - "value": "--feedback--", - "position": { - "start": { "line": 31, "column": 5, "offset": 232 }, - "end": { "line": 31, "column": 17, "offset": 244 } - } - } - ], - "position": { - "start": { "line": 31, "column": 1, "offset": 228 }, - "end": { "line": 31, "column": 17, "offset": 244 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "That is not correct.", - "position": { - "start": { "line": 33, "column": 1, "offset": 246 }, - "end": { "line": 33, "column": 21, "offset": 266 } - } - } - ], - "position": { - "start": { "line": 33, "column": 1, "offset": 246 }, - "end": { "line": 33, "column": 21, "offset": 266 } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { "line": 35, "column": 1, "offset": 268 }, - "end": { "line": 35, "column": 4, "offset": 271 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some ", - "position": { - "start": { "line": 37, "column": 1, "offset": 273 }, - "end": { "line": 37, "column": 6, "offset": 278 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "italics", - "position": { - "start": { "line": 37, "column": 7, "offset": 279 }, - "end": { "line": 37, "column": 14, "offset": 286 } - } - } - ], - "position": { - "start": { "line": 37, "column": 6, "offset": 278 }, - "end": { "line": 37, "column": 15, "offset": 287 } - } - } - ], - "position": { - "start": { "line": 37, "column": 1, "offset": 273 }, - "end": { "line": 37, "column": 15, "offset": 287 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A second answer paragraph.", - "position": { - "start": { "line": 39, "column": 1, "offset": 289 }, - "end": { "line": 39, "column": 27, "offset": 315 } - } - } - ], - "position": { - "start": { "line": 39, "column": 1, "offset": 289 }, - "end": { "line": 39, "column": 27, "offset": 315 } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { "line": 41, "column": 1, "offset": 317 }, - "end": { "line": 41, "column": 4, "offset": 320 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "", - "position": { - "start": { "line": 43, "column": 1, "offset": 322 }, - "end": { "line": 43, "column": 7, "offset": 328 } - } - }, - { - "type": "text", - "value": " code in ", - "position": { - "start": { "line": 43, "column": 7, "offset": 328 }, - "end": { "line": 43, "column": 16, "offset": 337 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 43, "column": 16, "offset": 337 }, - "end": { "line": 43, "column": 23, "offset": 344 } - } - }, - { - "type": "text", - "value": " code tags", - "position": { - "start": { "line": 43, "column": 23, "offset": 344 }, - "end": { "line": 43, "column": 33, "offset": 354 } - } - } - ], - "position": { - "start": { "line": 43, "column": 1, "offset": 322 }, - "end": { "line": 43, "column": 33, "offset": 354 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--video-solution--", - "position": { - "start": { "line": 45, "column": 4, "offset": 359 }, - "end": { "line": 45, "column": 22, "offset": 377 } - } - } - ], - "position": { - "start": { "line": 45, "column": 1, "offset": 356 }, - "end": { "line": 45, "column": 22, "offset": 377 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "3", - "position": { - "start": { "line": 47, "column": 1, "offset": 379 }, - "end": { "line": 47, "column": 2, "offset": 380 } - } - } - ], - "position": { - "start": { "line": 47, "column": 1, "offset": 379 }, - "end": { "line": 47, "column": 2, "offset": 380 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 48, "column": 1, "offset": 381 } - } -} \ No newline at end of file diff --git a/tools/challenge-parser/parser/__fixtures__/ast-video-out-of-order.json b/tools/challenge-parser/parser/__fixtures__/ast-video-out-of-order.json deleted file mode 100644 index 2d832d5795a..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-video-out-of-order.json +++ /dev/null @@ -1,346 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 7, "column": 4, "offset": 56 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 9, "column": 3, "offset": 60 }, - "end": { "line": 9, "column": 19, "offset": 76 } - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 58 }, - "end": { "line": 9, "column": 19, "offset": 76 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 } - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 91 }, - "end": { "line": 15, "column": 4, "offset": 117 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--text--", - "position": { - "start": { "line": 17, "column": 4, "offset": 122 }, - "end": { "line": 17, "column": 12, "offset": 130 } - } - } - ], - "position": { - "start": { "line": 17, "column": 1, "offset": 119 }, - "end": { "line": 17, "column": 12, "offset": 130 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Question line 1", - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 16, "offset": 147 } - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 16, "offset": 147 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": " var x = 'y';", - "position": { - "start": { "line": 21, "column": 1, "offset": 149 }, - "end": { "line": 23, "column": 4, "offset": 173 } - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--questions--", - "position": { - "start": { "line": 25, "column": 3, "offset": 177 }, - "end": { "line": 25, "column": 16, "offset": 190 } - } - } - ], - "position": { - "start": { "line": 25, "column": 1, "offset": 175 }, - "end": { "line": 25, "column": 16, "offset": 190 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--answers--", - "position": { - "start": { "line": 27, "column": 4, "offset": 195 }, - "end": { "line": 27, "column": 15, "offset": 206 } - } - } - ], - "position": { - "start": { "line": 27, "column": 1, "offset": 192 }, - "end": { "line": 27, "column": 15, "offset": 206 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some inline ", - "position": { - "start": { "line": 29, "column": 1, "offset": 208 }, - "end": { "line": 29, "column": 13, "offset": 220 } - } - }, - { - "type": "inlineCode", - "value": "code", - "position": { - "start": { "line": 29, "column": 13, "offset": 220 }, - "end": { "line": 29, "column": 19, "offset": 226 } - } - } - ], - "position": { - "start": { "line": 29, "column": 1, "offset": 208 }, - "end": { "line": 29, "column": 19, "offset": 226 } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { "line": 31, "column": 1, "offset": 228 }, - "end": { "line": 31, "column": 4, "offset": 231 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some ", - "position": { - "start": { "line": 33, "column": 1, "offset": 233 }, - "end": { "line": 33, "column": 6, "offset": 238 } - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "italics", - "position": { - "start": { "line": 33, "column": 7, "offset": 239 }, - "end": { "line": 33, "column": 14, "offset": 246 } - } - } - ], - "position": { - "start": { "line": 33, "column": 6, "offset": 238 }, - "end": { "line": 33, "column": 15, "offset": 247 } - } - } - ], - "position": { - "start": { "line": 33, "column": 1, "offset": 233 }, - "end": { "line": 33, "column": 15, "offset": 247 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A second answer paragraph.", - "position": { - "start": { "line": 35, "column": 1, "offset": 249 }, - "end": { "line": 35, "column": 27, "offset": 275 } - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 249 }, - "end": { "line": 35, "column": 27, "offset": 275 } - } - }, - { - "type": "thematicBreak", - "position": { - "start": { "line": 37, "column": 1, "offset": 277 }, - "end": { "line": 37, "column": 4, "offset": 280 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "", - "position": { - "start": { "line": 39, "column": 1, "offset": 282 }, - "end": { "line": 39, "column": 7, "offset": 288 } - } - }, - { - "type": "text", - "value": " code in ", - "position": { - "start": { "line": 39, "column": 7, "offset": 288 }, - "end": { "line": 39, "column": 16, "offset": 297 } - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 39, "column": 16, "offset": 297 }, - "end": { "line": 39, "column": 23, "offset": 304 } - } - }, - { - "type": "text", - "value": " code tags", - "position": { - "start": { "line": 39, "column": 23, "offset": 304 }, - "end": { "line": 39, "column": 33, "offset": 314 } - } - } - ], - "position": { - "start": { "line": 39, "column": 1, "offset": 282 }, - "end": { "line": 39, "column": 33, "offset": 314 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--video-solution--", - "position": { - "start": { "line": 41, "column": 4, "offset": 319 }, - "end": { "line": 41, "column": 22, "offset": 337 } - } - } - ], - "position": { - "start": { "line": 41, "column": 1, "offset": 316 }, - "end": { "line": 41, "column": 22, "offset": 337 } - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "3", - "position": { - "start": { "line": 43, "column": 1, "offset": 339 }, - "end": { "line": 43, "column": 2, "offset": 340 } - } - } - ], - "position": { - "start": { "line": 43, "column": 1, "offset": 339 }, - "end": { "line": 43, "column": 2, "offset": 340 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 44, "column": 1, "offset": 341 } - } -} \ No newline at end of file diff --git a/tools/challenge-parser/parser/__fixtures__/ast-with-extra-lines.json b/tools/challenge-parser/parser/__fixtures__/ast-with-extra-lines.json deleted file mode 100644 index 49208394e06..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-with-extra-lines.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 11, "offset": 10 } - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 3, "column": 4, "offset": 15 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 12 }, - "end": { "line": 3, "column": 21, "offset": 32 } - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 5, "column": 1, "offset": 34 }, - "end": { "line": 10, "column": 4, "offset": 79 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "key-for-css" }, - "children": [], - "position": { - "start": { "line": 11, "column": 1, "offset": 80 }, - "end": { "line": 11, "column": 19, "offset": 98 } - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 15, "column": 1, "offset": 102 }, - "end": { "line": 19, "column": 4, "offset": 142 } - } - }, - { - "type": "leafDirective", - "name": "id", - "attributes": { "id": "key-for-js" }, - "children": [], - "position": { - "start": { "line": 24, "column": 1, "offset": 147 }, - "end": { "line": 24, "column": 18, "offset": 164 } - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 25, "column": 1, "offset": 165 }, - "end": { "line": 27, "column": 4, "offset": 187 } - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 28, "column": 1, "offset": 188 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-with-jsx.json b/tools/challenge-parser/parser/__fixtures__/ast-with-jsx.json deleted file mode 100644 index fe1b0dab845..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-with-jsx.json +++ /dev/null @@ -1,1072 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When you add a lower rank heading element to the page, it's implied that you're starting a new subsection.", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 107, "offset": 125 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 107, "offset": 125 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "After the last ", - "position": { - "start": { "line": 5, "column": 1, "offset": 127 }, - "end": { "line": 5, "column": 16, "offset": 142 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 5, "column": 16, "offset": 142 }, - "end": { "line": 5, "column": 22, "offset": 148 }, - "indent": [] - } - }, - { - "type": "text", - "value": "h2", - "position": { - "start": { "line": 5, "column": 22, "offset": 148 }, - "end": { "line": 5, "column": 24, "offset": 150 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 5, "column": 24, "offset": 150 }, - "end": { "line": 5, "column": 31, "offset": 157 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element of the second ", - "position": { - "start": { "line": 5, "column": 31, "offset": 157 }, - "end": { "line": 5, "column": 54, "offset": 180 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 5, "column": 54, "offset": 180 }, - "end": { "line": 5, "column": 63, "offset": 189 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element, add an ", - "position": { - "start": { "line": 5, "column": 63, "offset": 189 }, - "end": { "line": 5, "column": 80, "offset": 206 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h3", - "position": { - "start": { "line": 5, "column": 80, "offset": 206 }, - "end": { "line": 5, "column": 84, "offset": 210 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element with the text ", - "position": { - "start": { "line": 5, "column": 84, "offset": 210 }, - "end": { "line": 5, "column": 107, "offset": 233 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "Things cats love:", - "position": { - "start": { "line": 5, "column": 107, "offset": 233 }, - "end": { "line": 5, "column": 126, "offset": 252 }, - "indent": [] - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 5, "column": 126, "offset": 252 }, - "end": { "line": 5, "column": 127, "offset": 253 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 5, "column": 1, "offset": 127 }, - "end": { "line": 5, "column": 127, "offset": 253 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "
\n

Some text in a blockquote

\n

\n Some text in a blockquote, with code\n

\n
", - "position": { - "start": { "line": 7, "column": 1, "offset": 255 }, - "end": { "line": 12, "column": 14, "offset": 383 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 14, "column": 3, "offset": 387 }, - "end": { "line": 14, "column": 19, "offset": 403 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 14, "column": 1, "offset": 385 }, - "end": { "line": 14, "column": 19, "offset": 403 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Do something with the ", - "position": { - "start": { "line": 16, "column": 1, "offset": 405 }, - "end": { "line": 16, "column": 23, "offset": 427 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "code", - "position": { - "start": { "line": 16, "column": 23, "offset": 427 }, - "end": { "line": 16, "column": 29, "offset": 433 }, - "indent": [] - } - }, - { - "type": "text", - "value": ".", - "position": { - "start": { "line": 16, "column": 29, "offset": 433 }, - "end": { "line": 16, "column": 30, "offset": 434 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 16, "column": 1, "offset": 405 }, - "end": { "line": 16, "column": 30, "offset": 434 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "To test that adjacent tags are handled correctly:", - "position": { - "start": { "line": 18, "column": 1, "offset": 436 }, - "end": { "line": 18, "column": 50, "offset": 485 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 18, "column": 1, "offset": 436 }, - "end": { "line": 18, "column": 50, "offset": 485 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a bit of ", - "position": { - "start": { "line": 20, "column": 1, "offset": 487 }, - "end": { "line": 20, "column": 10, "offset": 496 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 20, "column": 10, "offset": 496 }, - "end": { "line": 20, "column": 16, "offset": 502 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 20, "column": 16, "offset": 502 }, - "end": { "line": 20, "column": 20, "offset": 506 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 20, "column": 20, "offset": 506 }, - "end": { "line": 20, "column": 27, "offset": 513 }, - "indent": [] - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 20, "column": 27, "offset": 513 }, - "end": { "line": 20, "column": 28, "offset": 514 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 20, "column": 28, "offset": 514 }, - "end": { "line": 20, "column": 33, "offset": 519 }, - "indent": [] - } - }, - { - "type": "text", - "value": "with more after a space", - "position": { - "start": { "line": 20, "column": 33, "offset": 519 }, - "end": { "line": 20, "column": 56, "offset": 542 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 20, "column": 56, "offset": 542 }, - "end": { "line": 20, "column": 62, "offset": 548 }, - "indent": [] - } - }, - { - "type": "text", - "value": " and another pair of ", - "position": { - "start": { "line": 20, "column": 62, "offset": 548 }, - "end": { "line": 20, "column": 83, "offset": 569 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 20, "column": 83, "offset": 569 }, - "end": { "line": 20, "column": 91, "offset": 577 }, - "indent": [] - } - }, - { - "type": "text", - "value": "elements", - "position": { - "start": { "line": 20, "column": 91, "offset": 577 }, - "end": { "line": 20, "column": 99, "offset": 585 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 20, "column": 99, "offset": 585 }, - "end": { "line": 20, "column": 108, "offset": 594 }, - "indent": [] - } - }, - { - "type": "text", - "value": " ", - "position": { - "start": { "line": 20, "column": 108, "offset": 594 }, - "end": { "line": 20, "column": 109, "offset": 595 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 20, "column": 109, "offset": 595 }, - "end": { "line": 20, "column": 113, "offset": 599 }, - "indent": [] - } - }, - { - "type": "text", - "value": "with a space", - "position": { - "start": { "line": 20, "column": 113, "offset": 599 }, - "end": { "line": 20, "column": 125, "offset": 611 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 20, "column": 125, "offset": 611 }, - "end": { "line": 20, "column": 130, "offset": 616 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 20, "column": 1, "offset": 487 }, - "end": { "line": 20, "column": 130, "offset": 616 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 22, "column": 3, "offset": 620 }, - "end": { "line": 22, "column": 12, "offset": 629 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 22, "column": 1, "offset": 618 }, - "end": { "line": 22, "column": 12, "offset": 629 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-1", - "label": "test-id-1", - "referenceType": "shortcut", - "alt": "test-id-1", - "position": { - "start": { "line": 24, "column": 1, "offset": 631 }, - "end": { "line": 24, "column": 13, "offset": 643 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 24, "column": 1, "offset": 631 }, - "end": { "line": 24, "column": 13, "offset": 643 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second ", - "position": { - "start": { "line": 26, "column": 1, "offset": 645 }, - "end": { "line": 26, "column": 12, "offset": 656 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 26, "column": 12, "offset": 656 }, - "end": { "line": 26, "column": 21, "offset": 665 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element appears to be missing or does not have both an opening and closing tag.", - "position": { - "start": { "line": 26, "column": 21, "offset": 665 }, - "end": { "line": 26, "column": 101, "offset": 745 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 26, "column": 1, "offset": 645 }, - "end": { "line": 26, "column": 101, "offset": 745 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "assert(\n document.querySelectorAll('main > section')[1] &&\n code.match(/\\<\\/section>/g).length == 2\n);", - "position": { - "start": { "line": 28, "column": 1, "offset": 747 }, - "end": { "line": 33, "column": 4, "offset": 863 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-2", - "label": "test-id-2", - "referenceType": "shortcut", - "alt": "test-id-2", - "position": { - "start": { "line": 35, "column": 1, "offset": 865 }, - "end": { "line": 35, "column": 13, "offset": 877 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 865 }, - "end": { "line": 35, "column": 13, "offset": 877 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "There should be an ", - "position": { - "start": { "line": 37, "column": 1, "offset": 879 }, - "end": { "line": 37, "column": 20, "offset": 898 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h3", - "position": { - "start": { "line": 37, "column": 20, "offset": 898 }, - "end": { "line": 37, "column": 24, "offset": 902 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element right above the second ", - "position": { - "start": { "line": 37, "column": 24, "offset": 902 }, - "end": { "line": 37, "column": 56, "offset": 934 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 37, "column": 56, "offset": 934 }, - "end": { "line": 37, "column": 65, "offset": 943 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element's closing tag.", - "position": { - "start": { "line": 37, "column": 65, "offset": 943 }, - "end": { "line": 37, "column": 88, "offset": 966 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 1, "offset": 879 }, - "end": { "line": 37, "column": 88, "offset": 966 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "assert(\n document.querySelectorAll('main > section')[1].lastElementChild.nodeName ===\n 'H3'\n);", - "position": { - "start": { "line": 39, "column": 1, "offset": 968 }, - "end": { "line": 44, "column": 4, "offset": 1076 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-3", - "label": "test-id-3", - "referenceType": "shortcut", - "alt": "test-id-3", - "position": { - "start": { "line": 46, "column": 1, "offset": 1078 }, - "end": { "line": 46, "column": 13, "offset": 1090 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 46, "column": 1, "offset": 1078 }, - "end": { "line": 46, "column": 13, "offset": 1090 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ", - "position": { - "start": { "line": 48, "column": 1, "offset": 1092 }, - "end": { "line": 48, "column": 5, "offset": 1096 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h3", - "position": { - "start": { "line": 48, "column": 5, "offset": 1096 }, - "end": { "line": 48, "column": 9, "offset": 1100 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element right above the second ", - "position": { - "start": { "line": 48, "column": 9, "offset": 1100 }, - "end": { "line": 48, "column": 41, "offset": 1132 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 48, "column": 41, "offset": 1132 }, - "end": { "line": 48, "column": 50, "offset": 1141 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element's closing tag should have the text ", - "position": { - "start": { "line": 48, "column": 50, "offset": 1141 }, - "end": { "line": 48, "column": 94, "offset": 1185 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "Things cats love:", - "position": { - "start": { "line": 48, "column": 94, "offset": 1185 }, - "end": { "line": 48, "column": 113, "offset": 1204 }, - "indent": [] - } - }, - { - "type": "text", - "value": ". Make sure to include the colon at the end of the text.", - "position": { - "start": { "line": 48, "column": 113, "offset": 1204 }, - "end": { "line": 48, "column": 169, "offset": 1260 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 48, "column": 1, "offset": 1092 }, - "end": { "line": 48, "column": 169, "offset": 1260 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "assert(\n document\n .querySelectorAll('main > section')[1]\n .lastElementChild.innerText.toLowerCase()\n .replace(/\\s+/g, ' ') === 'things cats love:'\n);", - "position": { - "start": { "line": 50, "column": 1, "offset": 1262 }, - "end": { "line": 57, "column": 4, "offset": 1432 }, - "indent": [1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-4", - "label": "test-id-4", - "referenceType": "shortcut", - "alt": "test-id-4", - "position": { - "start": { "line": 59, "column": 1, "offset": 1434 }, - "end": { "line": 59, "column": 13, "offset": 1446 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 59, "column": 1, "offset": 1434 }, - "end": { "line": 59, "column": 13, "offset": 1446 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "There should be an ", - "position": { - "start": { "line": 61, "column": 1, "offset": 1448 }, - "end": { "line": 61, "column": 20, "offset": 1467 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h2", - "position": { - "start": { "line": 61, "column": 20, "offset": 1467 }, - "end": { "line": 61, "column": 24, "offset": 1471 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element with the text ", - "position": { - "start": { "line": 61, "column": 24, "offset": 1471 }, - "end": { "line": 61, "column": 47, "offset": 1494 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "Cat Lists", - "position": { - "start": { "line": 61, "column": 47, "offset": 1494 }, - "end": { "line": 61, "column": 58, "offset": 1505 }, - "indent": [] - } - }, - { - "type": "text", - "value": " above the last ", - "position": { - "start": { "line": 61, "column": 58, "offset": 1505 }, - "end": { "line": 61, "column": 74, "offset": 1521 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h3", - "position": { - "start": { "line": 61, "column": 74, "offset": 1521 }, - "end": { "line": 61, "column": 78, "offset": 1525 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element that is nested in the last ", - "position": { - "start": { "line": 61, "column": 78, "offset": 1525 }, - "end": { "line": 61, "column": 114, "offset": 1561 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "section", - "position": { - "start": { "line": 61, "column": 114, "offset": 1561 }, - "end": { "line": 61, "column": 123, "offset": 1570 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element'. You may have accidentally deleted the ", - "position": { - "start": { "line": 61, "column": 123, "offset": 1570 }, - "end": { "line": 61, "column": 172, "offset": 1619 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "h2", - "position": { - "start": { "line": 61, "column": 172, "offset": 1619 }, - "end": { "line": 61, "column": 176, "offset": 1623 }, - "indent": [] - } - }, - { - "type": "text", - "value": " element.", - "position": { - "start": { "line": 61, "column": 176, "offset": 1623 }, - "end": { "line": 61, "column": 185, "offset": 1632 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 61, "column": 1, "offset": 1448 }, - "end": { "line": 61, "column": 185, "offset": 1632 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "const secondSectionLastElemNode = document.querySelectorAll('main > section')[1]\n .lastElementChild;\nassert(\n secondSectionLastElemNode.nodeName === 'H3' &&\n secondSectionLastElemNode.previousElementSibling.innerText\n .toLowerCase()\n .replace(/\\s+/g, ' ') === 'cat lists'\n);", - "position": { - "start": { "line": 63, "column": 1, "offset": 1634 }, - "end": { "line": 72, "column": 4, "offset": 1933 }, - "indent": [1, 1, 1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 74, "column": 3, "offset": 1937 }, - "end": { "line": 74, "column": 11, "offset": 1945 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 74, "column": 1, "offset": 1935 }, - "end": { "line": 74, "column": 11, "offset": 1945 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 76, "column": 1, "offset": 1947 }, - "end": { "line": 76, "column": 12, "offset": 1958 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 76, "column": 1, "offset": 1947 }, - "end": { "line": 76, "column": 12, "offset": 1958 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n

CatPhotoApp

\n
\n
\n

Cat Photos

\n \n

\n Click here to view more\n cat photos.\n

\n \n
\n --fcc-editable-region--\n
\n

Cat Lists

\n
\n --fcc-editable-region--\n
\n \n", - "position": { - "start": { "line": 78, "column": 1, "offset": 1960 }, - "end": { "line": 106, "column": 4, "offset": 2649 }, - "indent": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}\n\nh1 {\n font-size: 20px;\n}\n--fcc-editable-region--\n\n--fcc-editable-region--\n\na {\n color: green;\n}", - "position": { - "start": { "line": 108, "column": 1, "offset": 2651 }, - "end": { "line": 123, "column": 4, "offset": 2790 }, - "indent": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "final-key", - "label": "final-key", - "referenceType": "shortcut", - "alt": "final-key", - "position": { - "start": { "line": 125, "column": 1, "offset": 2792 }, - "end": { "line": 125, "column": 13, "offset": 2804 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 125, "column": 1, "offset": 2792 }, - "end": { "line": 125, "column": 13, "offset": 2804 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 127, "column": 1, "offset": 2806 }, - "end": { "line": 129, "column": 4, "offset": 2828 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 131, "column": 3, "offset": 2832 }, - "end": { "line": 131, "column": 15, "offset": 2844 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 131, "column": 1, "offset": 2830 }, - "end": { "line": 131, "column": 15, "offset": 2844 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 133, "column": 1, "offset": 2846 }, - "end": { "line": 133, "column": 12, "offset": 2857 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 133, "column": 1, "offset": 2846 }, - "end": { "line": 133, "column": 12, "offset": 2857 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n

CatPhotoApp

\n
\n
\n

Cat Photos

\n \n

\n Click here to view more\n cat photos.\n

\n \n
\n
\n

Cat Lists

\n
\n
\n \n", - "position": { - "start": { "line": 135, "column": 1, "offset": 2859 }, - "end": { "line": 161, "column": 4, "offset": 3488 }, - "indent": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}\n\nh1 {\n font-size: 20px;\n}\n--fcc-editable-region--\n\n--fcc-editable-region--\n\na {\n color: green;\n}", - "position": { - "start": { "line": 163, "column": 1, "offset": 3490 }, - "end": { "line": 178, "column": 4, "offset": 3629 }, - "indent": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "final-key", - "label": "final-key", - "referenceType": "shortcut", - "alt": "final-key", - "position": { - "start": { "line": 180, "column": 1, "offset": 3631 }, - "end": { "line": 180, "column": 13, "offset": 3643 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 180, "column": 1, "offset": 3631 }, - "end": { "line": 180, "column": 13, "offset": 3643 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 182, "column": 1, "offset": 3645 }, - "end": { "line": 184, "column": 4, "offset": 3667 }, - "indent": [1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 185, "column": 1, "offset": 3668 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-with-markers.json b/tools/challenge-parser/parser/__fixtures__/ast-with-markers.json deleted file mode 100644 index 556b589f112..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-with-markers.json +++ /dev/null @@ -1,533 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 1, "column": 3, "offset": 2 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 1, "column": 18, "offset": 17 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 7, "column": 4, "offset": 56 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--instructions--", - "position": { - "start": { "line": 9, "column": 3, "offset": 60 }, - "end": { "line": 9, "column": 19, "offset": 76 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 58 }, - "end": { "line": 9, "column": 19, "offset": 76 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 78 }, - "end": { "line": 11, "column": 12, "offset": 89 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 13, "column": 1, "offset": 91 }, - "end": { "line": 15, "column": 4, "offset": 117 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--hints--", - "position": { - "start": { "line": 17, "column": 3, "offset": 121 }, - "end": { "line": 17, "column": 12, "offset": 130 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 17, "column": 1, "offset": 119 }, - "end": { "line": 17, "column": 12, "offset": 130 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-1", - "label": "test-id-1", - "referenceType": "shortcut", - "alt": "test-id-1", - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 13, "offset": 144 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 19, "column": 1, "offset": 132 }, - "end": { "line": 19, "column": 13, "offset": 144 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 21, "column": 1, "offset": 146 }, - "end": { "line": 21, "column": 11, "offset": 156 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 21, "column": 1, "offset": 146 }, - "end": { "line": 21, "column": 11, "offset": 156 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 23, "column": 1, "offset": 158 }, - "end": { "line": 25, "column": 4, "offset": 180 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-2", - "label": "test-id-2", - "referenceType": "shortcut", - "alt": "test-id-2", - "position": { - "start": { "line": 27, "column": 1, "offset": 182 }, - "end": { "line": 27, "column": 13, "offset": 194 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 27, "column": 1, "offset": 182 }, - "end": { "line": 27, "column": 13, "offset": 194 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 29, "column": 1, "offset": 196 }, - "end": { "line": 29, "column": 18, "offset": 213 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 29, "column": 18, "offset": 213 }, - "end": { "line": 29, "column": 24, "offset": 219 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 29, "column": 24, "offset": 219 }, - "end": { "line": 29, "column": 28, "offset": 223 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 29, "column": 28, "offset": 223 }, - "end": { "line": 29, "column": 35, "offset": 230 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 29, "column": 1, "offset": 196 }, - "end": { "line": 29, "column": 35, "offset": 230 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 31, "column": 1, "offset": 232 }, - "end": { "line": 33, "column": 4, "offset": 259 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-3", - "label": "test-id-3", - "referenceType": "shortcut", - "alt": "test-id-3", - "position": { - "start": { "line": 35, "column": 1, "offset": 261 }, - "end": { "line": 35, "column": 13, "offset": 273 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 261 }, - "end": { "line": 35, "column": 13, "offset": 273 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Third ", - "position": { - "start": { "line": 37, "column": 1, "offset": 275 }, - "end": { "line": 37, "column": 7, "offset": 281 }, - "indent": [] - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "hint", - "position": { - "start": { "line": 37, "column": 8, "offset": 282 }, - "end": { "line": 37, "column": 12, "offset": 286 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 7, "offset": 281 }, - "end": { "line": 37, "column": 13, "offset": 287 }, - "indent": [] - } - }, - { - "type": "text", - "value": " with ", - "position": { - "start": { "line": 37, "column": 13, "offset": 287 }, - "end": { "line": 37, "column": 19, "offset": 293 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 37, "column": 19, "offset": 293 }, - "end": { "line": 37, "column": 25, "offset": 299 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 37, "column": 25, "offset": 299 }, - "end": { "line": 37, "column": 29, "offset": 303 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 37, "column": 29, "offset": 303 }, - "end": { "line": 37, "column": 36, "offset": 310 }, - "indent": [] - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 37, "column": 36, "offset": 310 }, - "end": { "line": 37, "column": 41, "offset": 315 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "inline code", - "position": { - "start": { "line": 37, "column": 41, "offset": 315 }, - "end": { "line": 37, "column": 54, "offset": 328 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 37, "column": 1, "offset": 275 }, - "end": { "line": 37, "column": 54, "offset": 328 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code\nif(let x of xs) {\n console.log(x);\n}", - "position": { - "start": { "line": 39, "column": 1, "offset": 330 }, - "end": { "line": 44, "column": 4, "offset": 395 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--seed--", - "position": { - "start": { "line": 46, "column": 3, "offset": 399 }, - "end": { "line": 46, "column": 11, "offset": 407 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 46, "column": 1, "offset": 397 }, - "end": { "line": 46, "column": 11, "offset": 407 }, - "indent": [] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--seed-contents--", - "position": { - "start": { "line": 48, "column": 4, "offset": 412 }, - "end": { "line": 48, "column": 20, "offset": 428 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 48, "column": 1, "offset": 409 }, - "end": { "line": 48, "column": 20, "offset": 428 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 50, "column": 1, "offset": 430 }, - "end": { "line": 55, "column": 4, "offset": 475 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n--fcc-editable-region--\n background: green;\n\n--fcc-editable-region--\n}", - "position": { - "start": { "line": 57, "column": 1, "offset": 477 }, - "end": { "line": 64, "column": 4, "offset": 566 }, - "indent": [1, 1, 1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 66, "column": 1, "offset": 568 }, - "end": { "line": 68, "column": 4, "offset": 590 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 1, - "children": [ - { - "type": "text", - "value": "--solutions--", - "position": { - "start": { "line": 71, "column": 3, "offset": 595 }, - "end": { "line": 71, "column": 15, "offset": 607 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 71, "column": 1, "offset": 593 }, - "end": { "line": 71, "column": 15, "offset": 607 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 73, "column": 1, "offset": 609 }, - "end": { "line": 73, "column": 12, "offset": 620 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 73, "column": 1, "offset": 609 }, - "end": { "line": 73, "column": 12, "offset": 620 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 75, "column": 1, "offset": 622 }, - "end": { "line": 80, "column": 4, "offset": 667 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: white;\n}", - "position": { - "start": { "line": 82, "column": 1, "offset": 669 }, - "end": { "line": 86, "column": 4, "offset": 709 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';\n``\n", - "position": { - "start": { "line": 88, "column": 1, "offset": 711 }, - "end": { "line": 91, "column": 1, "offset": 733 }, - "indent": [1, 1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 91, "column": 1, "offset": 733 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/ast-yaml-challenge.json b/tools/challenge-parser/parser/__fixtures__/ast-yaml-challenge.json deleted file mode 100644 index 9c03c48926c..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/ast-yaml-challenge.json +++ /dev/null @@ -1,333 +0,0 @@ -{ - "type": "root", - "children": [ - { - "type": "yaml", - "value": "id: bd7123c8c441eddfaeb5bdef\ntitle: Say Hello to HTML Elements\nchallengeType: 0\nvideoUrl: 'https://scrimba.com/p/pVMPUv/cE8Gpt2'\nforumTopicId: 18276", - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 7, "column": 4, "offset": 156 }, - "indent": [1, 1, 1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--step-description--", - "position": { - "start": { "line": 9, "column": 4, "offset": 161 }, - "end": { "line": 9, "column": 24, "offset": 181 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 9, "column": 1, "offset": 158 }, - "end": { "line": 9, "column": 24, "offset": 181 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 11, "column": 1, "offset": 183 }, - "end": { "line": 11, "column": 12, "offset": 194 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 183 }, - "end": { "line": 11, "column": 12, "offset": 194 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example", - "position": { - "start": { "line": 13, "column": 1, "offset": 196 }, - "end": { "line": 15, "column": 4, "offset": 220 }, - "indent": [1, 1] - } - }, - { - "type": "code", - "lang": "yaml", - "meta": null, - "value": "key:\n - subkey: value\n anothersubkey: another value", - "position": { - "start": { "line": 17, "column": 1, "offset": 222 }, - "end": { "line": 21, "column": 4, "offset": 289 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--step-instructions--", - "position": { - "start": { "line": 23, "column": 4, "offset": 294 }, - "end": { "line": 23, "column": 25, "offset": 315 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 23, "column": 1, "offset": 291 }, - "end": { "line": 23, "column": 25, "offset": 315 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 0", - "position": { - "start": { "line": 25, "column": 1, "offset": 317 }, - "end": { "line": 25, "column": 12, "offset": 328 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 25, "column": 1, "offset": 317 }, - "end": { "line": 25, "column": 12, "offset": 328 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "code example 0", - "position": { - "start": { "line": 27, "column": 1, "offset": 330 }, - "end": { "line": 29, "column": 4, "offset": 356 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--step-hints--", - "position": { - "start": { "line": 31, "column": 4, "offset": 361 }, - "end": { "line": 31, "column": 18, "offset": 375 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 31, "column": 1, "offset": 358 }, - "end": { "line": 31, "column": 18, "offset": 375 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-1", - "label": "test-id-1", - "referenceType": "shortcut", - "alt": "test-id-1", - "position": { - "start": { "line": 33, "column": 1, "offset": 377 }, - "end": { "line": 33, "column": 13, "offset": 389 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 33, "column": 1, "offset": 377 }, - "end": { "line": 33, "column": 13, "offset": 389 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "First hint", - "position": { - "start": { "line": 35, "column": 1, "offset": 391 }, - "end": { "line": 35, "column": 11, "offset": 401 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 35, "column": 1, "offset": 391 }, - "end": { "line": 35, "column": 11, "offset": 401 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// test code", - "position": { - "start": { "line": 37, "column": 1, "offset": 403 }, - "end": { "line": 39, "column": 4, "offset": 425 }, - "indent": [1, 1] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "test-id-2", - "label": "test-id-2", - "referenceType": "shortcut", - "alt": "test-id-2", - "position": { - "start": { "line": 41, "column": 1, "offset": 427 }, - "end": { "line": 41, "column": 13, "offset": 439 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 41, "column": 1, "offset": 427 }, - "end": { "line": 41, "column": 13, "offset": 439 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Second hint with ", - "position": { - "start": { "line": 43, "column": 1, "offset": 441 }, - "end": { "line": 43, "column": 18, "offset": 458 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 43, "column": 18, "offset": 458 }, - "end": { "line": 43, "column": 24, "offset": 464 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 43, "column": 24, "offset": 464 }, - "end": { "line": 43, "column": 28, "offset": 468 }, - "indent": [] - } - }, - { - "type": "jsx", - "value": "", - "position": { - "start": { "line": 43, "column": 28, "offset": 468 }, - "end": { "line": 43, "column": 35, "offset": 475 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 43, "column": 1, "offset": 441 }, - "end": { "line": 43, "column": 35, "offset": 475 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "// more test code", - "position": { - "start": { "line": 45, "column": 1, "offset": 477 }, - "end": { "line": 47, "column": 4, "offset": 504 }, - "indent": [1, 1] - } - }, - { - "type": "heading", - "depth": 2, - "children": [ - { - "type": "text", - "value": "--step-seed--", - "position": { - "start": { "line": 49, "column": 4, "offset": 509 }, - "end": { "line": 49, "column": 17, "offset": 522 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 49, "column": 1, "offset": 506 }, - "end": { "line": 49, "column": 17, "offset": 522 }, - "indent": [] - } - }, - { - "type": "code", - "lang": "html", - "meta": null, - "value": "\n \n \n", - "position": { - "start": { "line": 51, "column": 1, "offset": 524 }, - "end": { "line": 56, "column": 4, "offset": 569 }, - "indent": [1, 1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "css", - "meta": null, - "value": "body {\n background: green;\n}", - "position": { - "start": { "line": 58, "column": 1, "offset": 571 }, - "end": { "line": 62, "column": 4, "offset": 611 }, - "indent": [1, 1, 1, 1] - } - }, - { - "type": "code", - "lang": "js", - "meta": null, - "value": "var x = 'y';", - "position": { - "start": { "line": 64, "column": 1, "offset": 613 }, - "end": { "line": 66, "column": 4, "offset": 635 }, - "indent": [1, 1] - } - } - ], - "position": { - "start": { "line": 1, "column": 1, "offset": 0 }, - "end": { "line": 67, "column": 1, "offset": 636 } - } -} diff --git a/tools/challenge-parser/parser/__fixtures__/document-two.md b/tools/challenge-parser/parser/__fixtures__/document-two.md deleted file mode 100644 index 6d5b0c28eac..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/document-two.md +++ /dev/null @@ -1,5 +0,0 @@ -# comp title - -some different text - -# another title diff --git a/tools/challenge-parser/parser/__fixtures__/document.md b/tools/challenge-parser/parser/__fixtures__/document.md deleted file mode 100644 index aea497dee93..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/document.md +++ /dev/null @@ -1,5 +0,0 @@ -# comp title - -some text - -# another title diff --git a/tools/challenge-parser/parser/__fixtures__/inline-html.md b/tools/challenge-parser/parser/__fixtures__/inline-html.md new file mode 100644 index 00000000000..7b4c3456d41 --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/inline-html.md @@ -0,0 +1 @@ + code in code tags _emphasis_ followed by
some nested html
diff --git a/tools/challenge-parser/parser/__fixtures__/mixed-nodes.md b/tools/challenge-parser/parser/__fixtures__/mixed-nodes.md new file mode 100644 index 00000000000..b39e8edac88 --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/mixed-nodes.md @@ -0,0 +1,3 @@ +Paragraph 1 + +Third _hint_ with code and `inline code` diff --git a/tools/challenge-parser/parser/__fixtures__/parse-fixture.js b/tools/challenge-parser/parser/__fixtures__/parse-fixture.js new file mode 100644 index 00000000000..e2ed63ecf0f --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/parse-fixture.js @@ -0,0 +1,13 @@ +const { join } = require('path'); +const remark = require('remark'); +const directive = require('remark-directive'); +const frontmatter = require('remark-frontmatter'); +const { read } = require('to-vfile'); + +const parseFixture = async (filename) => remark() + .use(directive) + .use(frontmatter, ['yaml']) + .parse(await read(join(__dirname, filename))); + + +module.exports = parseFixture; diff --git a/tools/challenge-parser/parser/__fixtures__/script-with-markers.md b/tools/challenge-parser/parser/__fixtures__/script-with-markers.md deleted file mode 100644 index 1bb273700c5..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/script-with-markers.md +++ /dev/null @@ -1,8 +0,0 @@ -```js -for (let index = 0; index < array.length; index++) { - const element = array[index]; - --fcc-editable-region-- - // imported from script.md - --fcc-editable-region-- -} -``` diff --git a/tools/challenge-parser/parser/__fixtures__/with-editable-markers-on-one-line.md b/tools/challenge-parser/parser/__fixtures__/with-editable-markers-on-one-line.md new file mode 100644 index 00000000000..a71dfafad83 --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/with-editable-markers-on-one-line.md @@ -0,0 +1,84 @@ +# --description-- + +Paragraph 1 + +```html +code example +``` + +# --instructions-- + +Paragraph 0 + +```html +code example 0 +``` + +# --hints-- + +First hint + +```js +// test code +``` + +Second hint with code + +```js +// more test code +``` + +Third *hint* with code and `inline code` + +```js +// more test code +if(let x of xs) { + console.log(x); +} +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + +``` + +```css +body { +--fcc-editable-region-- --fcc-editable-region-- + background: green; + + +} +``` + +```js +var x = 'y'; +``` + + +# --solutions-- + +::id{#html-key} + +```html + + + + +``` + +```css +body { + background: white; +} +``` + +```js +var x = 'y'; +``` diff --git a/tools/challenge-parser/parser/__fixtures__/with-empty-after.md b/tools/challenge-parser/parser/__fixtures__/with-empty-after.md new file mode 100644 index 00000000000..4105c90f7f6 --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/with-empty-after.md @@ -0,0 +1,95 @@ +# --description-- + +Paragraph 1 + +```html +code example +``` + +# --instructions-- + +Paragraph 0 + +```html +code example 0 +``` + +# --hints-- + +First hint + +```js +// test code +``` + +Second hint with code + +```js +// more test code +``` + +Third *hint* with code and `inline code` + +```js +// more test code +if(let x of xs) { + console.log(x); +} +``` + +# --seed-- + +## --before-user-code-- + +```css +body { + etc: '' +} +``` + +```html + +``` + +## --seed-contents-- + +```html + + + + +``` + +```css +body { + background: green; +} +``` + +```js +var x = 'y'; +``` + +## --after-user-code-- + + +# --solutions-- + +::id{#html-key} + +```html + + + + +``` + +```css +body { + background: white; +} +``` + +```js +var x = 'y'; +`` diff --git a/tools/challenge-parser/parser/__fixtures__/with-empty-before.md b/tools/challenge-parser/parser/__fixtures__/with-empty-before.md new file mode 100644 index 00000000000..b7ca414c065 --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/with-empty-before.md @@ -0,0 +1,96 @@ +# --description-- + +Paragraph 1 + +```html +code example +``` + +# --instructions-- + +Paragraph 0 + +```html +code example 0 +``` + +# --hints-- + +First hint + +```js +// test code +``` + +Second hint with code + +```js +// more test code +``` + +Third *hint* with code and `inline code` + +```js +// more test code +if(let x of xs) { + console.log(x); +} +``` + +# --seed-- + +## --before-user-code-- + +## --seed-contents-- + +```html + + + + +``` + +```css +body { + background: green; +} +``` + +```js +var x = 'y'; +``` + +## --after-user-code-- + +```css +body { + background: blue; +} +``` + +```js +function teardown(params) { + // after +} +``` + +# --solutions-- + +::id{#html-key} + +```html + + + + +``` + +```css +body { + background: white; +} +``` + +```js +var x = 'y'; +`` diff --git a/tools/challenge-parser/parser/__fixtures__/with-missing-seed-contents.md b/tools/challenge-parser/parser/__fixtures__/with-empty-contents.md similarity index 100% rename from tools/challenge-parser/parser/__fixtures__/with-missing-seed-contents.md rename to tools/challenge-parser/parser/__fixtures__/with-empty-contents.md diff --git a/tools/challenge-parser/parser/__fixtures__/incorrect-path/with-imports.md b/tools/challenge-parser/parser/__fixtures__/with-extra-heading.md similarity index 52% rename from tools/challenge-parser/parser/__fixtures__/incorrect-path/with-imports.md rename to tools/challenge-parser/parser/__fixtures__/with-extra-heading.md index cd4a90c5ee1..672448af023 100644 --- a/tools/challenge-parser/parser/__fixtures__/incorrect-path/with-imports.md +++ b/tools/challenge-parser/parser/__fixtures__/with-extra-heading.md @@ -1,7 +1,7 @@ -::import{component="Script" from="./script.md" } - # --description-- +# this should still be inside --description-- + Paragraph 1 ```html @@ -18,25 +18,31 @@ code example 0 # --hints-- -::id{#test-id-1} - First hint ```js // test code ``` -::id{#test-id-2} - Second hint with code ```js // more test code ``` +Third *hint* with code and `inline code` + +```js +// more test code +if(let x of xs) { + console.log(x); +} +``` # --seed-- +## --seed-contents-- + ```html @@ -50,10 +56,28 @@ body { } ``` -::id{#custom-name} - ```js var x = 'y'; ``` -::use{component="Script"} + +# --solutions-- + +::id{#html-key} + +```html + + + + +``` + +```css +body { + background: white; +} +``` + +```js +var x = 'y'; +`` diff --git a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-bad-paragraph.md b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-bad-paragraph.md index 141878a9b61..f24d94f638d 100644 --- a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-bad-paragraph.md +++ b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-bad-paragraph.md @@ -6,10 +6,10 @@ In English, to check or confirm something people sometimes use tag questions. Fo ## --sentence-- -`A sentence _ paragraph 1` +`A sentence BLANK paragraph 1` `not enough newlines, so no paragraph 2` -Sentence in _ 2 +Sentence in BLANK 2 ## --blanks-- diff --git a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-bad-sentence.md b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-bad-sentence.md index db12c2e27b3..95583847ccc 100644 --- a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-bad-sentence.md +++ b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-bad-sentence.md @@ -6,9 +6,9 @@ In English, to check or confirm something people sometimes use tag questions. Fo ## --sentence-- -`A sentence _ paragraph 1` +`A sentence BLANK paragraph 1` -Sentence in _ 2 +Sentence in BLANK 2 ## --blanks-- diff --git a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-many-blanks.md b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-many-blanks.md index 571000bf9c7..e8305639228 100644 --- a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-many-blanks.md +++ b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-many-blanks.md @@ -2,7 +2,7 @@ ## --sentence-- -`Sure thing! _ _ _.` +`Sure thing! BLANK _ _.` ## --blanks-- diff --git a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-one-blank.md b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-one-blank.md index 1a8e056c136..a535e808413 100644 --- a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-one-blank.md +++ b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-one-blank.md @@ -8,7 +8,7 @@ Maria is introducing herself and confirming Tom's job role. `Are` is used in the ## --sentence-- -`Hello, You _ the new graphic designer, right?` +`Hello, You BLANK the new graphic designer, right?` ## --blanks-- diff --git a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-two-sentences.md b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-two-sentences.md index 8732b5ab9ab..3c05a7118d8 100644 --- a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-two-sentences.md +++ b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank-two-sentences.md @@ -6,9 +6,9 @@ In English, to check or confirm something people sometimes use tag questions. Fo ## --sentence-- -`A sentence _ paragraph 1` +`A sentence BLANK paragraph 1` -`Sentence in _ 2` +`Sentence in BLANK 2` ## --blanks-- diff --git a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank.md b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank.md index 32501057177..178209d6e70 100644 --- a/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank.md +++ b/tools/challenge-parser/parser/__fixtures__/with-fill-in-the-blank.md @@ -8,7 +8,7 @@ Maria is introducing herself and confirming Tom's job role. `Are` is used in the ## --sentence-- -`Hello, You _ the new graphic designer, _? _ to meet you!` +`Hello, You BLANK the new graphic designer, BLANK? BLANK to meet you!` ## --blanks-- @@ -28,4 +28,4 @@ Feedback 2 --- -`Nice` \ No newline at end of file +`Nice` diff --git a/tools/challenge-parser/parser/__fixtures__/with-id-node.md b/tools/challenge-parser/parser/__fixtures__/with-id-node.md new file mode 100644 index 00000000000..1a1b018e80b --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/with-id-node.md @@ -0,0 +1,5 @@ +::id{#html-key} + +![test image](https://example.com/image.png) + +Paragraph with an image ![test image](https://example.com/image.png) in it. diff --git a/tools/challenge-parser/parser/__fixtures__/with-imports.md b/tools/challenge-parser/parser/__fixtures__/with-imports.md index b4ac2c4d60c..68b21fe3594 100644 --- a/tools/challenge-parser/parser/__fixtures__/with-imports.md +++ b/tools/challenge-parser/parser/__fixtures__/with-imports.md @@ -1,5 +1,4 @@ ::import{component="Script" from="./script.md" } -::import{component="Second" from="./script-two.md" } # --description-- diff --git a/tools/challenge-parser/parser/__fixtures__/with-invalid-after.md b/tools/challenge-parser/parser/__fixtures__/with-invalid-after.md new file mode 100644 index 00000000000..83cd5dbce8d --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/with-invalid-after.md @@ -0,0 +1,104 @@ +# --description-- + +Paragraph 1 + +```html +code example +``` + +# --instructions-- + +Paragraph 0 + +```html +code example 0 +``` + +# --hints-- + +First hint + +```js +// test code +``` + +Second hint with code + +```js +// more test code +``` + +Third *hint* with code and `inline code` + +```js +// more test code +if(let x of xs) { + console.log(x); +} +``` + +# --seed-- + +## --before-user-code-- + +```css +body { + etc: '' +} +``` + +```html + +``` + +## --seed-contents-- + +```html + + + + +``` + +```css +body { + background: green; +} +``` + +```js +var x = 'y'; +``` + +## --after-user-code-- + +```css +``` + +```js +function teardown(params) { + // after +} +``` + + +# --solutions-- + +::id{#html-key} + +```html + + + + +``` + +```css +body { + background: white; +} +``` + +```js +var x = 'y'; +`` diff --git a/tools/challenge-parser/parser/__fixtures__/with-invalid-before.md b/tools/challenge-parser/parser/__fixtures__/with-invalid-before.md new file mode 100644 index 00000000000..cc2dd40582c --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/with-invalid-before.md @@ -0,0 +1,104 @@ +# --description-- + +Paragraph 1 + +```html +code example +``` + +# --instructions-- + +Paragraph 0 + +```html +code example 0 +``` + +# --hints-- + +First hint + +```js +// test code +``` + +Second hint with code + +```js +// more test code +``` + +Third *hint* with code and `inline code` + +```js +// more test code +if(let x of xs) { + console.log(x); +} +``` + +# --seed-- + +## --before-user-code-- + +```css +``` + +```html + +``` + +## --seed-contents-- + +```html + + + + +``` + +```css +body { + background: green; +} +``` + +```js +var x = 'y'; +``` + +## --after-user-code-- + +```css +body { + background: blue; +} +``` + +```js +function teardown(params) { + // after +} +``` + + +# --solutions-- + +::id{#html-key} + +```html + + + + +``` + +```css +body { + background: white; +} +``` + +```js +var x = 'y'; +`` diff --git a/tools/challenge-parser/parser/__fixtures__/with-md-in-html.md b/tools/challenge-parser/parser/__fixtures__/with-md-in-html.md deleted file mode 100644 index 6e3a51dd415..00000000000 --- a/tools/challenge-parser/parser/__fixtures__/with-md-in-html.md +++ /dev/null @@ -1,3 +0,0 @@ -# --description-- - - code in code tags *emphasis* followed by
some nested html
diff --git a/tools/challenge-parser/parser/__fixtures__/with-missing-teststring.md b/tools/challenge-parser/parser/__fixtures__/with-missing-teststring.md new file mode 100644 index 00000000000..935834e170b --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/with-missing-teststring.md @@ -0,0 +1,5 @@ +# --hints-- + +First hint + +Whoops, this should have been a test code block diff --git a/tools/challenge-parser/parser/__fixtures__/with-multiple-video-questions.md b/tools/challenge-parser/parser/__fixtures__/with-multiple-video-questions.md new file mode 100644 index 00000000000..b517d05e846 --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/with-multiple-video-questions.md @@ -0,0 +1,77 @@ +# --description-- + +Paragraph 1 + +```html +code example +``` + +# --instructions-- + +Paragraph 0 + +```html +code example 0 +``` + +# --questions-- + +## --text-- + +Question line 1 + +```js + var x = 'y'; +``` + +## --answers-- + +Some inline `code` + +### --feedback-- + +That is not correct. + +--- + +Some *italics* + +A second answer paragraph. + +--- + + code in code tags + +## --video-solution-- + +3 + +## --text-- + +Question 2 + +```js + var anything = 'y'; +``` + +## --answers-- + +Some inline `code` again + +### --feedback-- + +That is not correct. + +--- + +Some *italics* + +A second answer paragraph. + +--- + + code in code tags + +## --video-solution-- + +2 diff --git a/tools/challenge-parser/parser/__fixtures__/with-seed-keys-jsx.md b/tools/challenge-parser/parser/__fixtures__/with-seed-keys-jsx.md new file mode 100644 index 00000000000..5d5a90a01d0 --- /dev/null +++ b/tools/challenge-parser/parser/__fixtures__/with-seed-keys-jsx.md @@ -0,0 +1,43 @@ +# --seed-- + +## --seed-contents-- + +```html + + + + +``` + +::id{#key-for-css} + +```css +body { + background: green; +} +``` + +::id{#key-for-jsx} + +```jsx +var x = 'y'; + +/* comment */ +const Button = () => { + return ; +}; +``` + +## --before-user-code-- + +```jsx +function setup() {} +``` + +## --after-user-code-- + +```jsx +function teardown(params) { + // after +} +``` diff --git a/tools/challenge-parser/parser/plugins/__snapshots__/add-frontmatter.test.js.snap b/tools/challenge-parser/parser/plugins/__snapshots__/add-frontmatter.test.js.snap index cd270cc1777..29c5bb6203d 100644 --- a/tools/challenge-parser/parser/plugins/__snapshots__/add-frontmatter.test.js.snap +++ b/tools/challenge-parser/parser/plugins/__snapshots__/add-frontmatter.test.js.snap @@ -5,6 +5,7 @@ exports[`process-frontmatter plugin should have an output to match the snapshot "challengeType": 0, "forumTopicId": 18276, "id": "bd7123c8c441eddfaeb5bdef", + "isHidden": false, "title": "Say Hello to HTML Elements", "videoUrl": "https://scrimba.com/p/pVMPUv/cE8Gpt2", } diff --git a/tools/challenge-parser/parser/plugins/__snapshots__/replace-imports.test.js.snap b/tools/challenge-parser/parser/plugins/__snapshots__/replace-imports.test.js.snap index 765efbab3fb..59fd5610527 100644 --- a/tools/challenge-parser/parser/plugins/__snapshots__/replace-imports.test.js.snap +++ b/tools/challenge-parser/parser/plugins/__snapshots__/replace-imports.test.js.snap @@ -10,12 +10,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 18, "line": 3, - "offset": 68, + "offset": 67, }, "start": { "column": 3, "line": 3, - "offset": 53, + "offset": 52, }, }, "type": "text", @@ -27,12 +27,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 18, "line": 3, - "offset": 68, + "offset": 67, }, "start": { "column": 1, "line": 3, - "offset": 51, + "offset": 50, }, }, "type": "heading", @@ -44,12 +44,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 12, "line": 5, - "offset": 81, + "offset": 80, }, "start": { "column": 1, "line": 5, - "offset": 70, + "offset": 69, }, }, "type": "text", @@ -60,12 +60,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 12, "line": 5, - "offset": 81, + "offset": 80, }, "start": { "column": 1, "line": 5, - "offset": 70, + "offset": 69, }, }, "type": "paragraph", @@ -77,12 +77,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 4, "line": 9, - "offset": 107, + "offset": 106, }, "start": { "column": 1, "line": 7, - "offset": 83, + "offset": 82, }, }, "type": "code", @@ -95,12 +95,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 19, "line": 11, - "offset": 127, + "offset": 126, }, "start": { "column": 3, "line": 11, - "offset": 111, + "offset": 110, }, }, "type": "text", @@ -112,12 +112,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 19, "line": 11, - "offset": 127, + "offset": 126, }, "start": { "column": 1, "line": 11, - "offset": 109, + "offset": 108, }, }, "type": "heading", @@ -129,12 +129,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 12, "line": 13, - "offset": 140, + "offset": 139, }, "start": { "column": 1, "line": 13, - "offset": 129, + "offset": 128, }, }, "type": "text", @@ -145,12 +145,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 12, "line": 13, - "offset": 140, + "offset": 139, }, "start": { "column": 1, "line": 13, - "offset": 129, + "offset": 128, }, }, "type": "paragraph", @@ -162,12 +162,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 4, "line": 17, - "offset": 168, + "offset": 167, }, "start": { "column": 1, "line": 15, - "offset": 142, + "offset": 141, }, }, "type": "code", @@ -180,12 +180,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 12, "line": 19, - "offset": 181, + "offset": 180, }, "start": { "column": 3, "line": 19, - "offset": 172, + "offset": 171, }, }, "type": "text", @@ -197,12 +197,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 12, "line": 19, - "offset": 181, + "offset": 180, }, "start": { "column": 1, "line": 19, - "offset": 170, + "offset": 169, }, }, "type": "heading", @@ -214,12 +214,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 11, "line": 21, - "offset": 193, + "offset": 192, }, "start": { "column": 1, "line": 21, - "offset": 183, + "offset": 182, }, }, "type": "text", @@ -230,12 +230,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 11, "line": 21, - "offset": 193, + "offset": 192, }, "start": { "column": 1, "line": 21, - "offset": 183, + "offset": 182, }, }, "type": "paragraph", @@ -247,12 +247,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 4, "line": 25, - "offset": 217, + "offset": 216, }, "start": { "column": 1, "line": 23, - "offset": 195, + "offset": 194, }, }, "type": "code", @@ -265,12 +265,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 18, "line": 27, - "offset": 236, + "offset": 235, }, "start": { "column": 1, "line": 27, - "offset": 219, + "offset": 218, }, }, "type": "text", @@ -281,12 +281,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 24, "line": 27, - "offset": 242, + "offset": 241, }, "start": { "column": 18, "line": 27, - "offset": 236, + "offset": 235, }, }, "type": "html", @@ -297,12 +297,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 28, "line": 27, - "offset": 246, + "offset": 245, }, "start": { "column": 24, "line": 27, - "offset": 242, + "offset": 241, }, }, "type": "text", @@ -313,12 +313,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 35, "line": 27, - "offset": 253, + "offset": 252, }, "start": { "column": 28, "line": 27, - "offset": 246, + "offset": 245, }, }, "type": "html", @@ -329,12 +329,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 35, "line": 27, - "offset": 253, + "offset": 252, }, "start": { "column": 1, "line": 27, - "offset": 219, + "offset": 218, }, }, "type": "paragraph", @@ -346,12 +346,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 4, "line": 31, - "offset": 282, + "offset": 281, }, "start": { "column": 1, "line": 29, - "offset": 255, + "offset": 254, }, }, "type": "code", @@ -364,12 +364,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 11, "line": 34, - "offset": 295, + "offset": 294, }, "start": { "column": 3, "line": 34, - "offset": 287, + "offset": 286, }, }, "type": "text", @@ -381,12 +381,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 11, "line": 34, - "offset": 295, + "offset": 294, }, "start": { "column": 1, "line": 34, - "offset": 285, + "offset": 284, }, }, "type": "heading", @@ -398,12 +398,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 21, "line": 36, - "offset": 317, + "offset": 316, }, "start": { "column": 4, "line": 36, - "offset": 300, + "offset": 299, }, }, "type": "text", @@ -415,12 +415,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 21, "line": 36, - "offset": 317, + "offset": 316, }, "start": { "column": 1, "line": 36, - "offset": 297, + "offset": 296, }, }, "type": "heading", @@ -432,12 +432,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 4, "line": 43, - "offset": 364, + "offset": 363, }, "start": { "column": 1, "line": 38, - "offset": 319, + "offset": 318, }, }, "type": "code", @@ -453,12 +453,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 4, "line": 49, - "offset": 406, + "offset": 405, }, "start": { "column": 1, "line": 45, - "offset": 366, + "offset": 365, }, }, "type": "code", @@ -467,39 +467,24 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` }", }, { - "children": [ - { - "alt": "custom-name", - "position": { - "end": { - "column": 17, - "line": 51, - "offset": 424, - }, - "start": { - "column": 1, - "line": 51, - "offset": 408, - }, - }, - "title": null, - "type": "image", - "url": "", - }, - ], + "attributes": { + "id": "custom-name", + }, + "children": [], + "name": "id", "position": { "end": { - "column": 17, + "column": 19, "line": 51, - "offset": 424, + "offset": 425, }, "start": { "column": 1, "line": 51, - "offset": 408, + "offset": 407, }, }, - "type": "paragraph", + "type": "leafDirective", }, { "lang": "js", @@ -508,12 +493,12 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 4, "line": 55, - "offset": 448, + "offset": 449, }, "start": { "column": 1, "line": 53, - "offset": 426, + "offset": 427, }, }, "type": "code", @@ -545,7 +530,7 @@ exports[`replace-imports should have an output to match the snapshot 1`] = ` "end": { "column": 1, "line": 58, - "offset": 476, + "offset": 477, }, "start": { "column": 1, diff --git a/tools/challenge-parser/parser/plugins/add-assignment.js b/tools/challenge-parser/parser/plugins/add-assignment.js index 75cdcf9d6c5..b18a6195297 100644 --- a/tools/challenge-parser/parser/plugins/add-assignment.js +++ b/tools/challenge-parser/parser/plugins/add-assignment.js @@ -1,4 +1,4 @@ -const getAllBetween = require('./utils/between-headings'); +const getSection = require('./utils/get-section'); const mdastToHtml = require('./utils/mdast-to-html'); const { splitOnThematicBreak } = require('./utils/split-on-thematic-break'); @@ -7,7 +7,7 @@ function plugin() { return transformer; function transformer(tree, file) { - const assignmentNodes = getAllBetween(tree, '--assignment--'); + const assignmentNodes = getSection(tree, '--assignment--'); const assignment = getAssignments(assignmentNodes).filter(a => a != ''); diff --git a/tools/challenge-parser/parser/plugins/add-fill-in-the-blank.js b/tools/challenge-parser/parser/plugins/add-fill-in-the-blank.js index ca9de454ee8..a7a1fe52f26 100644 --- a/tools/challenge-parser/parser/plugins/add-fill-in-the-blank.js +++ b/tools/challenge-parser/parser/plugins/add-fill-in-the-blank.js @@ -1,7 +1,7 @@ const { root } = require('mdast-builder'); const find = require('unist-util-find'); const visit = require('unist-util-visit'); -const getAllBetween = require('./utils/between-headings'); +const getSection = require('./utils/get-section'); const getAllBefore = require('./utils/before-heading'); const mdastToHtml = require('./utils/mdast-to-html'); @@ -36,14 +36,14 @@ Example of good formatting: function plugin() { return transformer; function transformer(tree, file) { - const fillInTheBlankNodes = getAllBetween(tree, '--fillInTheBlank--'); + const fillInTheBlankNodes = getSection(tree, '--fillInTheBlank--'); if (fillInTheBlankNodes.length > 0) { const fillInTheBlankTree = root(fillInTheBlankNodes); validateBlanksCount(fillInTheBlankTree); - const sentenceNodes = getAllBetween(fillInTheBlankTree, '--sentence--'); - const blanksNodes = getAllBetween(fillInTheBlankTree, '--blanks--'); + const sentenceNodes = getSection(fillInTheBlankTree, '--sentence--'); + const blanksNodes = getSection(fillInTheBlankTree, '--blanks--'); const fillInTheBlank = getfillInTheBlank(sentenceNodes, blanksNodes); @@ -97,7 +97,7 @@ function getBlanks(blanksNodes) { if (feedback) { const blanksNodes = getAllBefore(blanksTree, '--feedback--'); - const feedbackNodes = getAllBetween(blanksTree, '--feedback--'); + const feedbackNodes = getSection(blanksTree, '--feedback--'); return { answer: blanksNodes[0].children[0].value, diff --git a/tools/challenge-parser/parser/plugins/add-fill-in-the-blank.test.js b/tools/challenge-parser/parser/plugins/add-fill-in-the-blank.test.js index 73d02e45f38..ed0cf83af02 100644 --- a/tools/challenge-parser/parser/plugins/add-fill-in-the-blank.test.js +++ b/tools/challenge-parser/parser/plugins/add-fill-in-the-blank.test.js @@ -1,15 +1,35 @@ -const mockFillInTheBlankAST = require('../__fixtures__/ast-fill-in-the-blank.json'); -const mockFillInTheBlankYouAreAST = require('../__fixtures__/ast-fill-in-the-blank-one-blank.json'); -const mockFillInTheBlankTwoSentencesAST = require('../__fixtures__/ast-fill-in-the-blank-two-sentences.json'); -const mockFillInTheBlankBadSentence = require('../__fixtures__/ast-fill-in-the-blank-bad-sentence.json'); -const mockFillInTheBlankBadParagraph = require('../__fixtures__/ast-fill-in-the-blank-bad-paragraph.json'); -const mockFillInTheBlankMultipleBlanks = require('../__fixtures__/ast-fill-in-the-blank-many-blanks.json'); +const parseFixture = require('../__fixtures__/parse-fixture'); const addFillInTheBlankQuestion = require('./add-fill-in-the-blank'); describe('fill-in-the-blanks plugin', () => { + let mockFillInTheBlankAST, + mockFillInTheBlankYouAreAST, + mockFillInTheBlankTwoSentencesAST, + mockFillInTheBlankBadSentence, + mockFillInTheBlankBadParagraph, + mockFillInTheBlankMultipleBlanks; const plugin = addFillInTheBlankQuestion(); let file = { data: {} }; + beforeAll(async () => { + mockFillInTheBlankAST = await parseFixture('with-fill-in-the-blank.md'); + mockFillInTheBlankYouAreAST = await parseFixture( + 'with-fill-in-the-blank-one-blank.md' + ); + mockFillInTheBlankTwoSentencesAST = await parseFixture( + 'with-fill-in-the-blank-two-sentences.md' + ); + mockFillInTheBlankBadSentence = await parseFixture( + 'with-fill-in-the-blank-bad-sentence.md' + ); + mockFillInTheBlankBadParagraph = await parseFixture( + 'with-fill-in-the-blank-bad-paragraph.md' + ); + mockFillInTheBlankMultipleBlanks = await parseFixture( + 'with-fill-in-the-blank-many-blanks.md' + ); + }); + beforeEach(() => { file = { data: {} }; }); diff --git a/tools/challenge-parser/parser/plugins/add-frontmatter.test.js b/tools/challenge-parser/parser/plugins/add-frontmatter.test.js index af78cd392f5..15d01c60120 100644 --- a/tools/challenge-parser/parser/plugins/add-frontmatter.test.js +++ b/tools/challenge-parser/parser/plugins/add-frontmatter.test.js @@ -1,9 +1,15 @@ const { isObject } = require('lodash'); -const mockAST = require('../__fixtures__/ast-yaml-challenge.json'); +const parse = require('../__fixtures__/parse-fixture'); const processFrontmatter = require('./add-frontmatter'); describe('process-frontmatter plugin', () => { + let mockAST; + + beforeAll(async () => { + mockAST = await parse('with-frontmatter.md'); + }); + const plugin = processFrontmatter(); let file = { data: {} }; beforeEach(() => { @@ -26,6 +32,7 @@ describe('process-frontmatter plugin', () => { 'id', 'title', 'challengeType', + 'isHidden', 'videoUrl', 'forumTopicId' ]; @@ -35,7 +42,6 @@ describe('process-frontmatter plugin', () => { }); it('should not mutate any type held in the frontmatter', () => { - expect.assertions(5); plugin(mockAST, file); const { id, title, challengeType, videoUrl, forumTopicId } = file.data; expect(typeof id).toEqual('string'); @@ -46,7 +52,6 @@ describe('process-frontmatter plugin', () => { }); it('should trim extra whitespace from keys and values', () => { - expect.assertions(8); plugin(mockAST, file); const whitespaceRE = /(^\s\S+|\S\s$)/; const keys = Object.keys(file.data); diff --git a/tools/challenge-parser/parser/plugins/add-scene.js b/tools/challenge-parser/parser/plugins/add-scene.js index dd56d1ea526..b23ad4dd389 100644 --- a/tools/challenge-parser/parser/plugins/add-scene.js +++ b/tools/challenge-parser/parser/plugins/add-scene.js @@ -1,10 +1,10 @@ -const getAllBetween = require('./utils/between-headings'); +const getSection = require('./utils/get-section'); function plugin() { return transformer; function transformer(tree, file) { - const sceneNodes = getAllBetween(tree, '--scene--'); + const sceneNodes = getSection(tree, '--scene--'); if (sceneNodes.length > 0) { if (sceneNodes.length !== 1) { diff --git a/tools/challenge-parser/parser/plugins/add-seed.js b/tools/challenge-parser/parser/plugins/add-seed.js index 564ebb5c07f..c3a2a95fa74 100644 --- a/tools/challenge-parser/parser/plugins/add-seed.js +++ b/tools/challenge-parser/parser/plugins/add-seed.js @@ -1,7 +1,7 @@ const { isEmpty } = require('lodash'); const { root } = require('mdast-builder'); const visitChildren = require('unist-util-visit-children'); -const getAllBetween = require('./utils/between-headings'); +const getSection = require('./utils/get-section'); const { getFileVisitor } = require('./utils/get-file-visitor'); const editableRegionMarker = '--fcc-editable-region--'; @@ -33,13 +33,13 @@ function removeLines(contents, toRemove) { // TODO: DRY this. Start with an array of markers and go from there. function addSeeds() { function transformer(tree, file) { - const seedTree = root(getAllBetween(tree, `--seed--`)); + const seedTree = root(getSection(tree, `--seed--`)); // Not all challenges have seeds (video challenges, for example), so we stop // processing in these cases. if (isEmpty(seedTree.children)) return; - const contentsTree = root(getAllBetween(seedTree, `--seed-contents--`)); - const headTree = root(getAllBetween(seedTree, `--before-user-code--`)); - const tailTree = root(getAllBetween(seedTree, `--after-user-code--`)); + const contentsTree = root(getSection(seedTree, `--seed-contents--`)); + const headTree = root(getSection(seedTree, `--before-user-code--`)); + const tailTree = root(getSection(seedTree, `--after-user-code--`)); const seeds = {}; // While before and after code are optional, the contents are not diff --git a/tools/challenge-parser/parser/plugins/add-seed.test.js b/tools/challenge-parser/parser/plugins/add-seed.test.js index f13f9c04b50..cc7c0486678 100644 --- a/tools/challenge-parser/parser/plugins/add-seed.test.js +++ b/tools/challenge-parser/parser/plugins/add-seed.test.js @@ -1,28 +1,50 @@ const isArray = require('lodash/isArray'); - -const adjacentKeysAST = require('../__fixtures__/ast-adjacent-keys.json'); -const withBeforeAfterAST = require('../__fixtures__/ast-before-after.json'); -const cCodeAST = require('../__fixtures__/ast-c-code.json'); -const doubleMarkerAST = require('../__fixtures__/ast-double-marker.json'); -const emptyAfterAST = require('../__fixtures__/ast-empty-after.json'); -const emptyBeforeAST = require('../__fixtures__/ast-empty-before.json'); -const emptyContentAST = require('../__fixtures__/ast-empty-contents.json'); -const emptyCSSAST = require('../__fixtures__/ast-empty-css.json'); -const emptyHTMLAST = require('../__fixtures__/ast-empty-html.json'); -const explodedMarkerAST = require('../__fixtures__/ast-exploded-marker.json'); -const jsxSeedAST = require('../__fixtures__/ast-jsx-seed.json'); -const orphanKeyAST = require('../__fixtures__/ast-orphan-key.json'); -const withSeedKeysAST = require('../__fixtures__/ast-seed-keys.json'); -const simpleAST = require('../__fixtures__/ast-simple.json'); -const withExtraLinesAST = require('../__fixtures__/ast-with-extra-lines.json'); -const withEditableAST = require('../__fixtures__/ast-with-markers.json'); +const parseFixture = require('../__fixtures__/parse-fixture'); const addSeed = require('./add-seed'); describe('add-seed plugin', () => { + let adjacentKeysAST, + withSeedKeysAST, + withBeforeAfterAST, + cCodeAST, + withErmsOnOneLineAST, + withEmptyAfterAST, + withEmptyBeforeAST, + withEmptyContentsAST, + withInvalidBeforeAST, + withInvalidAfterAST, + simpleAST, + withEditableMarkersAST, + withSeedKeysOrphanAST, + withSeedKeysExtraLinesAST, + withSeedKeysJSXAST; + const plugin = addSeed(); let file = { data: {} }; + beforeAll(async () => { + adjacentKeysAST = await parseFixture('with-seed-keys-adjacent.md'); + withSeedKeysAST = await parseFixture('with-seed-keys.md'); + withBeforeAfterAST = await parseFixture('with-before-and-after.md'); + cCodeAST = await parseFixture('with-c-code.md'); + withErmsOnOneLineAST = await parseFixture( + 'with-editable-markers-on-one-line.md' + ); + withEmptyAfterAST = await parseFixture('with-empty-after.md'); + withEmptyBeforeAST = await parseFixture('with-empty-before.md'); + withEmptyContentsAST = await parseFixture('with-empty-contents.md'); + withInvalidBeforeAST = await parseFixture('with-invalid-before.md'); + withInvalidAfterAST = await parseFixture('with-invalid-after.md'); + simpleAST = await parseFixture('simple.md'); + withEditableMarkersAST = await parseFixture('with-editable-markers.md'); + withSeedKeysOrphanAST = await parseFixture('with-seed-keys-orphan.md'); + withSeedKeysExtraLinesAST = await parseFixture( + 'with-seed-keys-extra-lines.md' + ); + withSeedKeysJSXAST = await parseFixture('with-seed-keys-jsx.md'); + }); + beforeEach(() => { file = { data: {} }; }); @@ -87,7 +109,7 @@ describe('add-seed plugin', () => { it('removes region markers from contents', () => { expect.assertions(2); - plugin(withEditableAST, file); + plugin(withEditableMarkersAST, file); const { data: { challengeFiles } } = file; @@ -119,7 +141,7 @@ describe('add-seed plugin', () => { expect(() => plugin(adjacentKeysAST, file)).toThrow( '::id{#id}s must come before code blocks' ); - expect(() => plugin(orphanKeyAST, file)).toThrow( + expect(() => plugin(withSeedKeysOrphanAST, file)).toThrow( '::id{#id}s must come before code blocks' ); }); @@ -128,7 +150,7 @@ describe('add-seed plugin', () => { expect.assertions(1); plugin(withSeedKeysAST, file); const fileTwo = { data: {} }; - plugin(withExtraLinesAST, fileTwo); + plugin(withSeedKeysExtraLinesAST, fileTwo); expect(file).toEqual(fileTwo); }); @@ -178,17 +200,17 @@ describe('add-seed plugin', () => { it('throws if there is before/after code with empty blocks', () => { expect.assertions(2); - expect(() => plugin(emptyHTMLAST, file)).toThrow( + expect(() => plugin(withInvalidBeforeAST, file)).toThrow( 'Empty code block in --before-user-code-- section' ); - expect(() => plugin(emptyCSSAST, file)).toThrow( + expect(() => plugin(withInvalidAfterAST, file)).toThrow( 'Empty code block in --after-user-code-- section' ); }); it('quietly ignores empty before sections', () => { expect.assertions(6); - plugin(emptyBeforeAST, file); + plugin(withEmptyBeforeAST, file); const { data: { challengeFiles } } = file; @@ -206,7 +228,7 @@ describe('add-seed plugin', () => { it('quietly ignores empty after sections', () => { expect.assertions(6); - plugin(emptyAfterAST, file); + plugin(withEmptyAfterAST, file); const { data: { challengeFiles } } = file; @@ -224,21 +246,14 @@ describe('add-seed plugin', () => { it('throws an error (with line number) if 2 markers appear on 1 line', () => { expect.assertions(1); - expect(() => plugin(doubleMarkerAST, file)).toThrow( - `Line 8 has two markers. Each line should only have one.` - ); - }); - - it('throws if a javascript file has formatted a marker', () => { - expect.assertions(1); - expect(() => plugin(explodedMarkerAST, file)).toThrow( - `Line 66 has a malformed marker. It should be --fcc-editable-region--` + expect(() => plugin(withErmsOnOneLineAST, file)).toThrow( + `Line 53 has two markers. Each line should only have one.` ); }); it('handles jsx', () => { expect.assertions(3); - plugin(jsxSeedAST, file); + plugin(withSeedKeysJSXAST, file); const { data: { challengeFiles } } = file; @@ -276,12 +291,12 @@ const Button = () => { depending on what's easier to work with in graphQL }); - + */ it('should throw an error if a seed has no contents', () => { expect.assertions(1); - expect(() => plugin(emptyContentAST, file)).toThrow( + expect(() => plugin(withEmptyContentsAST, file)).toThrow( `## --seed-contents-- must appear in # --seed-- sections` ); }); diff --git a/tools/challenge-parser/parser/plugins/add-solution.js b/tools/challenge-parser/parser/plugins/add-solution.js index 30407aa47ca..a7194b3f613 100644 --- a/tools/challenge-parser/parser/plugins/add-solution.js +++ b/tools/challenge-parser/parser/plugins/add-solution.js @@ -3,7 +3,7 @@ const { root } = require('mdast-builder'); const visitChildren = require('unist-util-visit-children'); const { editableRegionMarker } = require('./add-seed'); -const getAllBetween = require('./utils/between-headings'); +const getSection = require('./utils/get-section'); const { getFileVisitor } = require('./utils/get-file-visitor'); const { splitOnThematicBreak } = require('./utils/split-on-thematic-break'); @@ -19,7 +19,7 @@ function validateMarkers({ value }) { function createPlugin() { return function transformer(tree, file) { const solutionArrays = splitOnThematicBreak( - getAllBetween(tree, `--solutions--`) + getSection(tree, `--solutions--`) ); const solutions = []; diff --git a/tools/challenge-parser/parser/plugins/add-solution.test.js b/tools/challenge-parser/parser/plugins/add-solution.test.js index ced1c598600..ff92e13f40a 100644 --- a/tools/challenge-parser/parser/plugins/add-solution.test.js +++ b/tools/challenge-parser/parser/plugins/add-solution.test.js @@ -1,11 +1,16 @@ const { isObject } = require('lodash'); -const editableSolutionAST = require('../__fixtures__/ast-erm-in-solution.json'); -const multiSolnsAST = require('../__fixtures__/ast-multiple-solutions.json'); -const mockAST = require('../__fixtures__/ast-simple.json'); - +const parseFixture = require('../__fixtures__/parse-fixture'); const addSolution = require('./add-solution'); describe('add solution plugin', () => { + let mockAST, multiSolnsAST, editableSolutionAST; + + beforeAll(async () => { + editableSolutionAST = await parseFixture('with-erm-in-solution.md'); + mockAST = await parseFixture('simple.md'); + multiSolnsAST = await parseFixture('with-multiple-solns.md'); + }); + const plugin = addSolution(); let file = { data: {} }; diff --git a/tools/challenge-parser/parser/plugins/add-tests.js b/tools/challenge-parser/parser/plugins/add-tests.js index e2b9c98f7f5..282db8f3c47 100644 --- a/tools/challenge-parser/parser/plugins/add-tests.js +++ b/tools/challenge-parser/parser/plugins/add-tests.js @@ -1,12 +1,12 @@ const chunk = require('lodash/chunk'); -const getAllBetween = require('./utils/between-headings'); +const getSection = require('./utils/get-section'); const mdastToHtml = require('./utils/mdast-to-html'); function plugin() { return transformer; function transformer(tree, file) { - const hintNodes = getAllBetween(tree, '--hints--'); + const hintNodes = getSection(tree, '--hints--'); if (hintNodes.length % 2 !== 0) throw Error('Tests must be in (text, ```testString```) order'); diff --git a/tools/challenge-parser/parser/plugins/add-tests.test.js b/tools/challenge-parser/parser/plugins/add-tests.test.js index c5abae0aed3..7aeccb4de9c 100644 --- a/tools/challenge-parser/parser/plugins/add-tests.test.js +++ b/tools/challenge-parser/parser/plugins/add-tests.test.js @@ -1,11 +1,17 @@ -const brokenHintsAST = require('../__fixtures__/ast-broken-hints.json'); -const simpleAST = require('../__fixtures__/ast-simple.json'); +const parseFixture = require('../__fixtures__/parse-fixture'); const addTests = require('./add-tests'); describe('add-tests plugin', () => { + let brokenHintsAST, simpleAST, missingTestStringAST; const plugin = addTests(); let file = { data: {} }; + beforeAll(async () => { + simpleAST = await parseFixture('simple.md'); + brokenHintsAST = await parseFixture('with-broken-hints.md'); + missingTestStringAST = await parseFixture('with-missing-teststring.md'); + }); + beforeEach(() => { file = { data: {} }; }); @@ -33,8 +39,14 @@ describe('add-tests plugin', () => { // TODO: make this a bit more robust and informative it('should throw if a test pair is out of order', () => { - expect.assertions(1); + // TODO: update the markdown so it makes this error expect(() => plugin(brokenHintsAST, file)).toThrow( + 'Tests must be in (text, ```testString```) order' + ); + }); + + it('should throw if a test string is not found', () => { + expect(() => plugin(missingTestStringAST, file)).toThrow( 'testString (code block) is missing from hint' ); }); diff --git a/tools/challenge-parser/parser/plugins/add-text.js b/tools/challenge-parser/parser/plugins/add-text.js index d5e95d92ee5..f31d3590aab 100644 --- a/tools/challenge-parser/parser/plugins/add-text.js +++ b/tools/challenge-parser/parser/plugins/add-text.js @@ -1,5 +1,5 @@ const { isEmpty } = require('lodash'); -const getAllBetween = require('./utils/between-headings'); +const getSection = require('./utils/get-section'); const mdastToHTML = require('./utils/mdast-to-html'); function addText(sectionIds) { @@ -8,7 +8,7 @@ function addText(sectionIds) { } function transformer(tree, file) { for (const sectionId of sectionIds) { - const textNodes = getAllBetween(tree, `--${sectionId}--`); + const textNodes = getSection(tree, `--${sectionId}--`); const sectionText = mdastToHTML(textNodes); if (!isEmpty(sectionText)) { diff --git a/tools/challenge-parser/parser/plugins/add-text.test.js b/tools/challenge-parser/parser/plugins/add-text.test.js index 45752e24c4b..1a421353d7d 100644 --- a/tools/challenge-parser/parser/plugins/add-text.test.js +++ b/tools/challenge-parser/parser/plugins/add-text.test.js @@ -1,15 +1,18 @@ -// eslint-disable-next-line max-len -const incorrectMarkersAST = require('../__fixtures__/ast-incorrect-markers.json'); -const realisticAST = require('../__fixtures__/ast-realistic.json'); -const mockAST = require('../__fixtures__/ast-simple.json'); +const parseFixture = require('../__fixtures__/parse-fixture'); const addText = require('./add-text'); describe('add-text', () => { + let realisticAST, mockAST; const descriptionId = 'description'; const instructionsId = 'instructions'; - // const unexpectedField = 'does-not-exist'; + const missingId = 'missing'; let file = { data: {} }; + beforeAll(async () => { + realisticAST = await parseFixture('realistic.md'); + mockAST = await parseFixture('simple.md'); + }); + beforeEach(() => { file = { data: {} }; }); @@ -83,8 +86,8 @@ describe('add-text', () => { // eslint-disable-next-line max-len it('should add nothing if a section id does not appear in the md', () => { - const plugin = addText([descriptionId]); - plugin(incorrectMarkersAST, file); + const plugin = addText([missingId]); + plugin(mockAST, file); expect(file.data[descriptionId]).toBeUndefined(); }); diff --git a/tools/challenge-parser/parser/plugins/add-video-question.js b/tools/challenge-parser/parser/plugins/add-video-question.js index 56aaead9331..f75decdc938 100644 --- a/tools/challenge-parser/parser/plugins/add-video-question.js +++ b/tools/challenge-parser/parser/plugins/add-video-question.js @@ -1,6 +1,6 @@ const { root } = require('mdast-builder'); const find = require('unist-util-find'); -const getAllBetween = require('./utils/between-headings'); +const getSection = require('./utils/get-section'); const getAllBefore = require('./utils/before-heading'); const mdastToHtml = require('./utils/mdast-to-html'); @@ -9,7 +9,7 @@ const { splitOnThematicBreak } = require('./utils/split-on-thematic-break'); function plugin() { return transformer; function transformer(tree, file) { - const allQuestionNodes = getAllBetween(tree, '--questions--'); + const allQuestionNodes = getSection(tree, '--questions--'); if (allQuestionNodes.length > 0) { const questions = []; @@ -28,9 +28,9 @@ function plugin() { questionTrees.forEach(questionNodes => { const questionTree = root(questionNodes); - const textNodes = getAllBetween(questionTree, '--text--'); - const answersNodes = getAllBetween(questionTree, '--answers--'); - const solutionNodes = getAllBetween(questionTree, '--video-solution--'); + const textNodes = getSection(questionTree, '--text--'); + const answersNodes = getSection(questionTree, '--answers--'); + const solutionNodes = getSection(questionTree, '--video-solution--'); questions.push(getQuestion(textNodes, answersNodes, solutionNodes)); }); @@ -61,7 +61,7 @@ function getAnswers(answersNodes) { if (feedback) { const answerNodes = getAllBefore(answerTree, '--feedback--'); - const feedbackNodes = getAllBetween(answerTree, '--feedback--'); + const feedbackNodes = getSection(answerTree, '--feedback--'); if (answerNodes.length < 1) { throw Error('Answer missing'); diff --git a/tools/challenge-parser/parser/plugins/add-video-question.test.js b/tools/challenge-parser/parser/plugins/add-video-question.test.js index 5914610bbbb..9d893ed2204 100644 --- a/tools/challenge-parser/parser/plugins/add-video-question.test.js +++ b/tools/challenge-parser/parser/plugins/add-video-question.test.js @@ -1,13 +1,22 @@ -const simpleAST = require('../__fixtures__/ast-simple.json'); -const mockVideoAST = require('../__fixtures__/ast-video-challenge.json'); -// eslint-disable-next-line max-len -const videoOutOfOrderAST = require('../__fixtures__/ast-video-out-of-order.json'); +const parseFixture = require('../__fixtures__/parse-fixture'); const addVideoQuestion = require('./add-video-question'); describe('add-video-question plugin', () => { + let simpleAST, videoAST, multipleQuestionAST, videoOutOfOrderAST; const plugin = addVideoQuestion(); let file = { data: {} }; + beforeAll(async () => { + simpleAST = await parseFixture('simple.md'); + videoAST = await parseFixture('with-video-question.md'); + multipleQuestionAST = await parseFixture( + 'with-multiple-video-questions.md' + ); + videoOutOfOrderAST = await parseFixture( + 'with-video-question-out-of-order.md' + ); + }); + beforeEach(() => { file = { data: {} }; }); @@ -17,32 +26,45 @@ describe('add-video-question plugin', () => { }); it('adds a `questions` property to `file.data`', () => { - plugin(mockVideoAST, file); + plugin(videoAST, file); expect('questions' in file.data).toBe(true); }); + const checkQuestion = question => { + expect(question).toHaveProperty('text'); + expect(typeof question.text).toBe('string'); + expect(question).toHaveProperty('solution'); + expect(typeof question.solution).toBe('number'); + expect(question).toHaveProperty('answers'); + expect(Array.isArray(question.answers)).toBe(true); + expect(typeof question.answers[0]).toBe('object'); + expect(question.answers[0]).toHaveProperty('answer'); + expect(question.answers[0].answer).toBeTruthy(); + expect(question.answers[0]).toHaveProperty('feedback'); + }; + it('should generate a questions array from a video challenge AST', () => { - expect.assertions(11); - plugin(mockVideoAST, file); + plugin(videoAST, file); const testArr = file.data.questions; expect(Array.isArray(testArr)).toBe(true); expect(testArr.length).toBe(1); - const testObject = testArr[0]; - expect(testObject).toHaveProperty('text'); - expect(typeof testObject.text).toBe('string'); - expect(testObject).toHaveProperty('solution'); - expect(typeof testObject.solution).toBe('number'); - expect(testObject).toHaveProperty('answers'); - expect(Array.isArray(testObject.answers)).toBe(true); - expect(typeof testObject.answers[0]).toBe('object'); - expect(testObject.answers[0]).toHaveProperty('answer'); - expect(testObject.answers[0]).toHaveProperty('feedback'); + checkQuestion(testArr[0]); + }); + + it('should include multiple questions if present', () => { + plugin(multipleQuestionAST, file); + const testArr = file.data.questions; + expect(Array.isArray(testArr)).toBe(true); + expect(testArr.length).toBe(2); + for (const testObject of testArr) { + checkQuestion(testObject); + } }); it('should convert question and answer markdown into html', () => { - plugin(mockVideoAST, file); + plugin(videoAST, file); const testObject = file.data.questions[0]; expect(Object.keys(testObject).length).toBe(3); expect(testObject.text).toBe( @@ -79,7 +101,7 @@ describe('add-video-question plugin', () => { }); it('should match the video snapshot', () => { - plugin(mockVideoAST, file); + plugin(videoAST, file); expect(file.data).toMatchSnapshot(); }); }); diff --git a/tools/challenge-parser/parser/plugins/replace-imports.test.js b/tools/challenge-parser/parser/plugins/replace-imports.test.js index b3baf78f46e..c00ef586edc 100644 --- a/tools/challenge-parser/parser/plugins/replace-imports.test.js +++ b/tools/challenge-parser/parser/plugins/replace-imports.test.js @@ -2,22 +2,32 @@ const path = require('path'); const cloneDeep = require('lodash/cloneDeep'); const toVfile = require('to-vfile'); const selectAll = require('unist-util-select').selectAll; +const parseFixture = require('../__fixtures__/parse-fixture'); -const originalImportsExtraAST = require('../__fixtures__/ast-imports-extra.json'); -const originalImportsTwoAST = require('../__fixtures__/ast-imports-two.json'); -const originalImportsAST = require('../__fixtures__/ast-imports.json'); -const originalMarkerAST = require('../__fixtures__/ast-marker-imports.json'); -const originalSimpleAST = require('../__fixtures__/ast-simple.json'); const addImports = require('./replace-imports'); describe('replace-imports', () => { - let importsAST; - let importsTwoAST; - let importsExtraAST; - let simpleAST; - let markerAST; - let correctFile; - let incorrectFile; + let importsAST, + importsTwoAST, + importsExtraAST, + simpleAST, + markerAST, + correctFile, + incorrectFile; + + let originalImportsAST, + originalImportsTwoAST, + originalImportsExtraAST, + originalMarkerAST, + originalSimpleAST; + + beforeAll(async () => { + originalImportsAST = await parseFixture('with-imports.md'); + originalImportsTwoAST = await parseFixture('with-imports-two.md'); + originalImportsExtraAST = await parseFixture('with-imports-extra.md'); + originalSimpleAST = await parseFixture('simple.md'); + originalMarkerAST = await parseFixture('with-marker-imports.md'); + }); beforeEach(() => { importsAST = cloneDeep(originalImportsAST); diff --git a/tools/challenge-parser/parser/plugins/restore-directives.test.js b/tools/challenge-parser/parser/plugins/restore-directives.test.js index c2ee139f5ee..1ca664c33eb 100644 --- a/tools/challenge-parser/parser/plugins/restore-directives.test.js +++ b/tools/challenge-parser/parser/plugins/restore-directives.test.js @@ -2,11 +2,14 @@ const cloneDeep = require('lodash/cloneDeep'); const find = require('unist-util-find'); const { selectAll } = require('unist-util-select'); -const directivesOriginalAST = require('../__fixtures__/ast-directives.json'); +const parseFixture = require('../__fixtures__/parse-fixture'); const restoreDirectives = require('./restore-directives'); describe('restore-directives', () => { - let directivesAST; + let directivesAST, directivesOriginalAST; + beforeAll(async () => { + directivesOriginalAST = await parseFixture('with-directives.md'); + }); beforeEach(() => { directivesAST = cloneDeep(directivesOriginalAST); }); diff --git a/tools/challenge-parser/parser/plugins/utils/__fixtures__/id-node.json b/tools/challenge-parser/parser/plugins/utils/__fixtures__/id-node.json deleted file mode 100644 index 3fe6e924939..00000000000 --- a/tools/challenge-parser/parser/plugins/utils/__fixtures__/id-node.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "type": "leafDirective", - "name": "id", - "attributes": { "id": "html-key" }, - "children": [], - "position": { - "start": { "line": 29, "column": 1, "offset": 200 }, - "end": { "line": 29, "column": 16, "offset": 215 } - } -} diff --git a/tools/challenge-parser/parser/plugins/utils/__fixtures__/image-node.json b/tools/challenge-parser/parser/plugins/utils/__fixtures__/image-node.json deleted file mode 100644 index eb5f04ee063..00000000000 --- a/tools/challenge-parser/parser/plugins/utils/__fixtures__/image-node.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "type": "paragraph", - "children": [ - { - "type": "image", - "title": null, - "url": "https://www.image.com", - "alt": "html-key", - "position": { - "start": { "line": 65, "column": 1, "offset": 481 }, - "end": { "line": 65, "column": 35, "offset": 515 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 65, "column": 1, "offset": 481 }, - "end": { "line": 65, "column": 35, "offset": 515 }, - "indent": [] - } -} diff --git a/tools/challenge-parser/parser/plugins/utils/__fixtures__/leading-html-node.json b/tools/challenge-parser/parser/plugins/utils/__fixtures__/leading-html-node.json deleted file mode 100644 index b325ccad099..00000000000 --- a/tools/challenge-parser/parser/plugins/utils/__fixtures__/leading-html-node.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 7, "offset": 25 }, - "indent": [] - } - }, - { - "type": "text", - "value": " code in ", - "position": { - "start": { "line": 3, "column": 7, "offset": 25 }, - "end": { "line": 3, "column": 16, "offset": 34 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3, "column": 16, "offset": 34 }, - "end": { "line": 3, "column": 23, "offset": 41 }, - "indent": [] - } - }, - { - "type": "text", - "value": " code tags ", - "position": { - "start": { "line": 3, "column": 23, "offset": 41 }, - "end": { "line": 3, "column": 34, "offset": 52 }, - "indent": [] - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "emphasis", - "position": { - "start": { "line": 3, "column": 35, "offset": 53 }, - "end": { "line": 3, "column": 43, "offset": 61 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 34, "offset": 52 }, - "end": { "line": 3, "column": 44, "offset": 62 }, - "indent": [] - } - }, - { - "type": "text", - "value": " followed by ", - "position": { - "start": { "line": 3, "column": 44, "offset": 62 }, - "end": { "line": 3, "column": 57, "offset": 75 }, - "indent": [] - } - }, - { - "type": "html", - "value": "
", - "position": { - "start": { "line": 3, "column": 57, "offset": 75 }, - "end": { "line": 3, "column": 62, "offset": 80 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3, "column": 62, "offset": 80 }, - "end": { "line": 3, "column": 68, "offset": 86 }, - "indent": [] - } - }, - { - "type": "text", - "value": "some nested html ", - "position": { - "start": { "line": 3, "column": 68, "offset": 86 }, - "end": { "line": 3, "column": 85, "offset": 103 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 3, "column": 85, "offset": 103 }, - "end": { "line": 3, "column": 92, "offset": 110 }, - "indent": [] - } - }, - { - "type": "html", - "value": "
", - "position": { - "start": { "line": 3, "column": 92, "offset": 110 }, - "end": { "line": 3, "column": 98, "offset": 116 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 98, "offset": 116 }, - "indent": [] - } -} diff --git a/tools/challenge-parser/parser/plugins/utils/__fixtures__/mdast-mixed-nodes.json b/tools/challenge-parser/parser/plugins/utils/__fixtures__/mdast-mixed-nodes.json deleted file mode 100644 index bde6f56aff7..00000000000 --- a/tools/challenge-parser/parser/plugins/utils/__fixtures__/mdast-mixed-nodes.json +++ /dev/null @@ -1,113 +0,0 @@ -[ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Paragraph 1", - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 3, "column": 1, "offset": 19 }, - "end": { "line": 3, "column": 12, "offset": 30 }, - "indent": [] - } - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Third ", - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 5, "column": 7, "offset": 38 }, - "indent": [] - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "hint", - "position": { - "start": { "line": 5, "column": 8, "offset": 39 }, - "end": { "line": 5, "column": 12, "offset": 43 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 5, "column": 7, "offset": 38 }, - "end": { "line": 5, "column": 13, "offset": 44 }, - "indent": [] - } - }, - { - "type": "text", - "value": " with ", - "position": { - "start": { "line": 5, "column": 13, "offset": 44 }, - "end": { "line": 5, "column": 19, "offset": 50 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5, "column": 19, "offset": 50 }, - "end": { "line": 5, "column": 25, "offset": 56 }, - "indent": [] - } - }, - { - "type": "text", - "value": "code", - "position": { - "start": { "line": 5, "column": 25, "offset": 56 }, - "end": { "line": 5, "column": 29, "offset": 60 }, - "indent": [] - } - }, - { - "type": "html", - "value": "", - "position": { - "start": { "line": 5, "column": 29, "offset": 60 }, - "end": { "line": 5, "column": 36, "offset": 67 }, - "indent": [] - } - }, - { - "type": "text", - "value": " and ", - "position": { - "start": { "line": 5, "column": 36, "offset": 67 }, - "end": { "line": 5, "column": 41, "offset": 72 }, - "indent": [] - } - }, - { - "type": "inlineCode", - "value": "inline code", - "position": { - "start": { "line": 5, "column": 41, "offset": 72 }, - "end": { "line": 5, "column": 54, "offset": 85 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 5, "column": 1, "offset": 32 }, - "end": { "line": 5, "column": 54, "offset": 85 }, - "indent": [] - } - } -] diff --git a/tools/challenge-parser/parser/plugins/utils/__fixtures__/mdast-with-em.json b/tools/challenge-parser/parser/plugins/utils/__fixtures__/mdast-with-em.json deleted file mode 100644 index bdbebfb6f79..00000000000 --- a/tools/challenge-parser/parser/plugins/utils/__fixtures__/mdast-with-em.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Just some ", - "position": { - "start": { "line": 11, "column": 1, "offset": 120 }, - "end": { "line": 11, "column": 11, "offset": 130 }, - "indent": [] - } - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "emphasis", - "position": { - "start": { "line": 11, "column": 12, "offset": 131 }, - "end": { "line": 11, "column": 20, "offset": 139 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 11, "offset": 130 }, - "end": { "line": 11, "column": 21, "offset": 140 }, - "indent": [] - } - }, - { - "type": "text", - "value": " and a bit of ", - "position": { - "start": { "line": 11, "column": 21, "offset": 140 }, - "end": { "line": 11, "column": 35, "offset": 154 }, - "indent": [] - } - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "bold", - "position": { - "start": { "line": 11, "column": 37, "offset": 156 }, - "end": { "line": 11, "column": 41, "offset": 160 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 35, "offset": 154 }, - "end": { "line": 11, "column": 43, "offset": 162 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 11, "column": 1, "offset": 120 }, - "end": { "line": 11, "column": 43, "offset": 162 }, - "indent": [] - } -} diff --git a/tools/challenge-parser/parser/plugins/utils/__fixtures__/multiple-children.json b/tools/challenge-parser/parser/plugins/utils/__fixtures__/multiple-children.json deleted file mode 100644 index 9f29a439930..00000000000 --- a/tools/challenge-parser/parser/plugins/utils/__fixtures__/multiple-children.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "type": "paragraph", - "children": [ - { - "type": "imageReference", - "identifier": "html-key", - "label": "html-key", - "referenceType": "shortcut", - "alt": "html-key", - "position": { - "start": { "line": 65, "column": 1, "offset": 481 }, - "end": { "line": 65, "column": 12, "offset": 492 }, - "indent": [] - } - }, - { - "type": "text", - "value": "\nMore stuff in the paragraph", - "position": { - "start": { "line": 65, "column": 12, "offset": 492 }, - "end": { "line": 66, "column": 28, "offset": 520 }, - "indent": [1] - } - } - ], - "position": { - "start": { "line": 65, "column": 1, "offset": 481 }, - "end": { "line": 66, "column": 28, "offset": 520 }, - "indent": [1] - } -} diff --git a/tools/challenge-parser/parser/plugins/utils/__fixtures__/non-id-node.json b/tools/challenge-parser/parser/plugins/utils/__fixtures__/non-id-node.json deleted file mode 100644 index feef51e1e1f..00000000000 --- a/tools/challenge-parser/parser/plugins/utils/__fixtures__/non-id-node.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "--description--", - "position": { - "start": { "line": 65, "column": 1, "offset": 481 }, - "end": { "line": 65, "column": 12, "offset": 492 }, - "indent": [] - } - } - ], - "position": { - "start": { "line": 65, "column": 1, "offset": 481 }, - "end": { "line": 65, "column": 12, "offset": 492 }, - "indent": [] - } -} diff --git a/tools/challenge-parser/parser/plugins/utils/__snapshots__/between-headings.test.js.snap b/tools/challenge-parser/parser/plugins/utils/__snapshots__/get-section.test.js.snap similarity index 98% rename from tools/challenge-parser/parser/plugins/utils/__snapshots__/between-headings.test.js.snap rename to tools/challenge-parser/parser/plugins/utils/__snapshots__/get-section.test.js.snap index e7c1b54d6f4..e6519540cc4 100644 --- a/tools/challenge-parser/parser/plugins/utils/__snapshots__/between-headings.test.js.snap +++ b/tools/challenge-parser/parser/plugins/utils/__snapshots__/get-section.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`between-headings should match the hints snapshot 1`] = ` +exports[`getSection should match the hints snapshot 1`] = ` [ { "children": [ @@ -338,7 +338,7 @@ if(let x of xs) { ] `; -exports[`between-headings should match the instructions snapshot 1`] = ` +exports[`getSection should match the instructions snapshot 1`] = ` [ { "children": [ diff --git a/tools/challenge-parser/parser/plugins/utils/before-heading.test.js b/tools/challenge-parser/parser/plugins/utils/before-heading.test.js index 9583d87dc96..9441b0d1cdb 100644 --- a/tools/challenge-parser/parser/plugins/utils/before-heading.test.js +++ b/tools/challenge-parser/parser/plugins/utils/before-heading.test.js @@ -1,8 +1,15 @@ const isArray = require('lodash/isArray'); -const simpleAst = require('../../__fixtures__/ast-simple.json'); + +const parseFixture = require('../../__fixtures__/parse-fixture'); const getAllBefore = require('./before-heading'); describe('before-headings', () => { + let simpleAst; + + beforeAll(async () => { + simpleAst = await parseFixture('simple.md'); + }); + it('should return an array', () => { expect.assertions(1); const actual = getAllBefore(simpleAst, '--hints--'); diff --git a/tools/challenge-parser/parser/plugins/utils/get-id.test.js b/tools/challenge-parser/parser/plugins/utils/get-id.test.js index 26c7647e843..15d52e21161 100644 --- a/tools/challenge-parser/parser/plugins/utils/get-id.test.js +++ b/tools/challenge-parser/parser/plugins/utils/get-id.test.js @@ -1,10 +1,14 @@ -const idNode = require('./__fixtures__/id-node.json'); -const imageNode = require('./__fixtures__/image-node.json'); -const multipleChildrenNode = require('./__fixtures__/multiple-children.json'); -const nonIdNode = require('./__fixtures__/non-id-node.json'); +const parseFixture = require('../../__fixtures__/parse-fixture'); const getId = require('./get-id'); describe('get-id', () => { + let idNode, imageNode, multipleChildrenNode; + beforeAll(async () => { + const withIdNode = await parseFixture('with-id-node.md'); + idNode = withIdNode.children[0]; + imageNode = withIdNode.children[1]; + multipleChildrenNode = withIdNode.children[2]; + }); it('should return a string', () => { expect.assertions(1); const actual = getId(idNode); @@ -19,7 +23,7 @@ describe('get-id', () => { it('should return null if the node does contain an id', () => { expect.assertions(1); - const actual = getId(nonIdNode); + const actual = getId(imageNode); expect(actual).toBeNull(); }); diff --git a/tools/challenge-parser/parser/plugins/utils/between-headings.js b/tools/challenge-parser/parser/plugins/utils/get-section.js similarity index 93% rename from tools/challenge-parser/parser/plugins/utils/between-headings.js rename to tools/challenge-parser/parser/plugins/utils/get-section.js index ecea2493faa..c93668cf7f8 100644 --- a/tools/challenge-parser/parser/plugins/utils/between-headings.js +++ b/tools/challenge-parser/parser/plugins/utils/get-section.js @@ -3,7 +3,7 @@ const findAfter = require('unist-util-find-after'); const findAllAfter = require('unist-util-find-all-after'); const between = require('unist-util-find-all-between'); -function getAllBetween(tree, marker) { +function getSection(tree, marker) { const start = find(tree, { type: 'heading', children: [ @@ -43,4 +43,4 @@ function getAllBetween(tree, marker) { return targetNodes; } -module.exports = getAllBetween; +module.exports = getSection; diff --git a/tools/challenge-parser/parser/plugins/utils/between-headings.test.js b/tools/challenge-parser/parser/plugins/utils/get-section.test.js similarity index 61% rename from tools/challenge-parser/parser/plugins/utils/between-headings.test.js rename to tools/challenge-parser/parser/plugins/utils/get-section.test.js index 07fe93c1985..683d2a710f3 100644 --- a/tools/challenge-parser/parser/plugins/utils/between-headings.test.js +++ b/tools/challenge-parser/parser/plugins/utils/get-section.test.js @@ -2,27 +2,33 @@ const isArray = require('lodash/isArray'); const { root } = require('mdast-builder'); const find = require('unist-util-find'); -const extraHeadingAst = require('../../__fixtures__/ast-extra-heading.json'); -const simpleAst = require('../../__fixtures__/ast-simple.json'); -const getAllBetween = require('./between-headings'); +const parseFixture = require('../../__fixtures__/parse-fixture'); +const getSection = require('./get-section'); + +describe('getSection', () => { + let simpleAst, extraHeadingAst; + + beforeAll(async () => { + extraHeadingAst = await parseFixture('with-extra-heading.md'); + simpleAst = await parseFixture('simple.md'); + }); -describe('between-headings', () => { it('should return an array', () => { expect.assertions(1); - const actual = getAllBetween(simpleAst, '--hints--'); + const actual = getSection(simpleAst, '--hints--'); expect(isArray(actual)).toBe(true); }); it('should return an empty array if the marker is not present', () => { expect.assertions(2); - const actual = getAllBetween(simpleAst, '--not-a-marker--'); + const actual = getSection(simpleAst, '--not-a-marker--'); expect(isArray(actual)).toBe(true); expect(actual.length).toBe(0); }); it('should include any headings without markers', () => { expect.assertions(1); - const actual = getAllBetween(extraHeadingAst, '--description--'); + const actual = getSection(extraHeadingAst, '--description--'); expect( find(root(actual), { value: 'this should still be inside --description--' @@ -32,7 +38,7 @@ describe('between-headings', () => { it('should include the rest of the AST if there is no end marker', () => { expect.assertions(2); - const actual = getAllBetween(extraHeadingAst, '--solutions--'); + const actual = getSection(extraHeadingAst, '--solutions--'); expect(actual.length > 0).toBe(true); expect( find(root(actual), { value: 'body {\n background: white;\n}' }) @@ -40,11 +46,11 @@ describe('between-headings', () => { }); it('should match the hints snapshot', () => { - const actual = getAllBetween(simpleAst, '--hints--'); + const actual = getSection(simpleAst, '--hints--'); expect(actual).toMatchSnapshot(); }); it('should match the instructions snapshot', () => { - const actual = getAllBetween(simpleAst, '--instructions--'); + const actual = getSection(simpleAst, '--instructions--'); expect(actual).toMatchSnapshot(); }); }); diff --git a/tools/challenge-parser/parser/plugins/utils/mdast-to-html.test.js b/tools/challenge-parser/parser/plugins/utils/mdast-to-html.test.js index c7b3d1e61bb..f7c19670ff7 100644 --- a/tools/challenge-parser/parser/plugins/utils/mdast-to-html.test.js +++ b/tools/challenge-parser/parser/plugins/utils/mdast-to-html.test.js @@ -1,10 +1,17 @@ -const leadingInlineHTMLNode = require('./__fixtures__/leading-html-node.json'); -const mdastMixedNodes = require('./__fixtures__/mdast-mixed-nodes.json'); -const mdastWithEmNode = require('./__fixtures__/mdast-with-em.json'); -const singleNode = require('./__fixtures__/non-id-node.json'); +const parseFixture = require('../../__fixtures__/parse-fixture'); const mdastToHTML = require('./mdast-to-html'); describe('mdast-to-html', () => { + let mdastMixedNodes, singleNode, inlineHTMLNodes; + + beforeAll(async () => { + const mdastMixedAST = await parseFixture('mixed-nodes.md'); + const mdastInlineHTMLAST = await parseFixture('inline-html.md'); + mdastMixedNodes = mdastMixedAST.children; + singleNode = mdastMixedAST.children[0]; + inlineHTMLNodes = mdastInlineHTMLAST.children; + }); + it('should return a string', () => { expect.assertions(1); const actual = mdastToHTML(mdastMixedNodes); @@ -18,13 +25,6 @@ describe('mdast-to-html', () => { ); }); - it('should convert markdown nodes into html', () => { - const actual = mdastToHTML([mdastWithEmNode]); - expect(actual).toBe( - '

Just some emphasis and a bit of bold

' - ); - }); - it('should not escape html', () => { const actual = mdastToHTML(mdastMixedNodes); expect(actual).toBe(`

Paragraph 1

@@ -32,7 +32,7 @@ describe('mdast-to-html', () => { }); it('should put inline html inside the enclosing paragraph', () => { - const actual = mdastToHTML([leadingInlineHTMLNode]); + const actual = mdastToHTML(inlineHTMLNodes); expect(actual).toBe( '

code in code tags emphasis followed' + ' by

some nested html

' diff --git a/tools/challenge-parser/parser/tools/generate-ast.js b/tools/challenge-parser/parser/tools/generate-ast.js index c777aed35a1..ed9a04491af 100644 --- a/tools/challenge-parser/parser/tools/generate-ast.js +++ b/tools/challenge-parser/parser/tools/generate-ast.js @@ -6,9 +6,10 @@ const { read } = require('to-vfile'); (async () => { const path = './example.md'; const file = await read(path); - await remark() + const out = await remark() .use(directive) .use(frontmatter, ['yaml']) - .use(() => tree => console.log(JSON.stringify(tree))) - .process(file); + .parse(file); + + console.log(out); })();