chore: remove old parser
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
e3511f2930
commit
a3a678b7af
@ -0,0 +1,95 @@
|
||||
{
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
617
tools/challenge-parser/parser/__fixtures__/ast-before-after.json
Normal file
617
tools/challenge-parser/parser/__fixtures__/ast-before-after.json
Normal file
@ -0,0 +1,617 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<!-- comment -->",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
502
tools/challenge-parser/parser/__fixtures__/ast-broken-hints.json
Normal file
502
tools/challenge-parser/parser/__fixtures__/ast-broken-hints.json
Normal file
@ -0,0 +1,502 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
218
tools/challenge-parser/parser/__fixtures__/ast-c-code.json
Normal file
218
tools/challenge-parser/parser/__fixtures__/ast-c-code.json
Normal file
@ -0,0 +1,218 @@
|
||||
{
|
||||
"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": "<!-- comment -->",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
{
|
||||
"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": "<html>\n <body>\n --fcc-editable-region-- --fcc-editable-region--\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
144
tools/challenge-parser/parser/__fixtures__/ast-empty-after.json
Normal file
144
tools/challenge-parser/parser/__fixtures__/ast-empty-after.json
Normal file
@ -0,0 +1,144 @@
|
||||
{
|
||||
"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": "<!-- comment -->",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
144
tools/challenge-parser/parser/__fixtures__/ast-empty-before.json
Normal file
144
tools/challenge-parser/parser/__fixtures__/ast-empty-before.json
Normal file
@ -0,0 +1,144 @@
|
||||
{
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,448 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<!-- comment -->",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
166
tools/challenge-parser/parser/__fixtures__/ast-empty-css.json
Normal file
166
tools/challenge-parser/parser/__fixtures__/ast-empty-css.json
Normal file
@ -0,0 +1,166 @@
|
||||
{
|
||||
"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": "<!-- comment -->",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
166
tools/challenge-parser/parser/__fixtures__/ast-empty-html.json
Normal file
166
tools/challenge-parser/parser/__fixtures__/ast-empty-html.json
Normal file
@ -0,0 +1,166 @@
|
||||
{
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
{
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,533 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body></body>\n</html>",
|
||||
"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": "<html>\n <body></body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,427 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
437
tools/challenge-parser/parser/__fixtures__/ast-gfm.json
Normal file
437
tools/challenge-parser/parser/__fixtures__/ast-gfm.json
Normal file
@ -0,0 +1,437 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
320
tools/challenge-parser/parser/__fixtures__/ast-imports-two.json
Normal file
320
tools/challenge-parser/parser/__fixtures__/ast-imports-two.json
Normal file
@ -0,0 +1,320 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
300
tools/challenge-parser/parser/__fixtures__/ast-imports.json
Normal file
300
tools/challenge-parser/parser/__fixtures__/ast-imports.json
Normal file
@ -0,0 +1,300 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,388 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
122
tools/challenge-parser/parser/__fixtures__/ast-jsx-seed.json
Normal file
122
tools/challenge-parser/parser/__fixtures__/ast-jsx-seed.json
Normal file
@ -0,0 +1,122 @@
|
||||
{
|
||||
"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 <button> {/* another comment! */} text </button>;\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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,303 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"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> code in </code> code tags *emphasis* followed by <div><span>some nested html </span></div>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,303 @@
|
||||
{
|
||||
"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": "<!-- comment -->",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n solution number two\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
{
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
1123
tools/challenge-parser/parser/__fixtures__/ast-realistic.json
Normal file
1123
tools/challenge-parser/parser/__fixtures__/ast-realistic.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,95 @@
|
||||
{
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
411
tools/challenge-parser/parser/__fixtures__/ast-simple.json
Normal file
411
tools/challenge-parser/parser/__fixtures__/ast-simple.json
Normal file
@ -0,0 +1,411 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,385 @@
|
||||
{
|
||||
"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": "--question--",
|
||||
"position": {
|
||||
"start": { "line": 17, "column": 3, "offset": 121 },
|
||||
"end": { "line": 17, "column": 15, "offset": 133 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 17, "column": 1, "offset": 119 },
|
||||
"end": { "line": 17, "column": 15, "offset": 133 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "heading",
|
||||
"depth": 2,
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "--text--",
|
||||
"position": {
|
||||
"start": { "line": 19, "column": 4, "offset": 138 },
|
||||
"end": { "line": 19, "column": 12, "offset": 146 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 19, "column": 1, "offset": 135 },
|
||||
"end": { "line": 19, "column": 12, "offset": 146 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Question line 1",
|
||||
"position": {
|
||||
"start": { "line": 21, "column": 1, "offset": 148 },
|
||||
"end": { "line": 21, "column": 16, "offset": 163 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 21, "column": 1, "offset": 148 },
|
||||
"end": { "line": 21, "column": 16, "offset": 163 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "code",
|
||||
"lang": "js",
|
||||
"meta": null,
|
||||
"value": " var x = 'y';",
|
||||
"position": {
|
||||
"start": { "line": 23, "column": 1, "offset": 165 },
|
||||
"end": { "line": 25, "column": 4, "offset": 189 },
|
||||
"indent": [1, 1]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "heading",
|
||||
"depth": 2,
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "--answers--",
|
||||
"position": {
|
||||
"start": { "line": 27, "column": 4, "offset": 194 },
|
||||
"end": { "line": 27, "column": 15, "offset": 205 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 27, "column": 1, "offset": 191 },
|
||||
"end": { "line": 27, "column": 15, "offset": 205 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Some inline ",
|
||||
"position": {
|
||||
"start": { "line": 29, "column": 1, "offset": 207 },
|
||||
"end": { "line": 29, "column": 13, "offset": 219 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "inlineCode",
|
||||
"value": "code",
|
||||
"position": {
|
||||
"start": { "line": 29, "column": 13, "offset": 219 },
|
||||
"end": { "line": 29, "column": 19, "offset": 225 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 29, "column": 1, "offset": 207 },
|
||||
"end": { "line": 29, "column": 19, "offset": 225 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "thematicBreak",
|
||||
"position": {
|
||||
"start": { "line": 31, "column": 1, "offset": 227 },
|
||||
"end": { "line": 31, "column": 4, "offset": 230 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Some ",
|
||||
"position": {
|
||||
"start": { "line": 33, "column": 1, "offset": 232 },
|
||||
"end": { "line": 33, "column": 6, "offset": 237 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "emphasis",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "italics",
|
||||
"position": {
|
||||
"start": { "line": 33, "column": 7, "offset": 238 },
|
||||
"end": { "line": 33, "column": 14, "offset": 245 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 33, "column": 6, "offset": 237 },
|
||||
"end": { "line": 33, "column": 15, "offset": 246 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 33, "column": 1, "offset": 232 },
|
||||
"end": { "line": 33, "column": 15, "offset": 246 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "A second answer paragraph.",
|
||||
"position": {
|
||||
"start": { "line": 35, "column": 1, "offset": 248 },
|
||||
"end": { "line": 35, "column": 27, "offset": 274 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 35, "column": 1, "offset": 248 },
|
||||
"end": { "line": 35, "column": 27, "offset": 274 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "thematicBreak",
|
||||
"position": {
|
||||
"start": { "line": 37, "column": 1, "offset": 276 },
|
||||
"end": { "line": 37, "column": 4, "offset": 279 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"position": {
|
||||
"start": { "line": 39, "column": 1, "offset": 281 },
|
||||
"end": { "line": 39, "column": 33, "offset": 313 },
|
||||
"indent": []
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "html",
|
||||
"value": "<code>",
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 1, "offset": 0 },
|
||||
"end": { "line": 1, "column": 7, "offset": 6 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": " code in ",
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 7, "offset": 6 },
|
||||
"end": { "line": 1, "column": 16, "offset": 15 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "html",
|
||||
"value": "</code>",
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 16, "offset": 15 },
|
||||
"end": { "line": 1, "column": 23, "offset": 22 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": " code tags",
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 23, "offset": 22 },
|
||||
"end": { "line": 1, "column": 33, "offset": 32 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "heading",
|
||||
"depth": 2,
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "--video-solution--",
|
||||
"position": {
|
||||
"start": { "line": 41, "column": 4, "offset": 318 },
|
||||
"end": { "line": 41, "column": 22, "offset": 336 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 41, "column": 1, "offset": 315 },
|
||||
"end": { "line": 41, "column": 22, "offset": 336 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "3",
|
||||
"position": {
|
||||
"start": { "line": 43, "column": 1, "offset": 338 },
|
||||
"end": { "line": 43, "column": 2, "offset": 339 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 43, "column": 1, "offset": 338 },
|
||||
"end": { "line": 43, "column": 2, "offset": 339 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 1, "offset": 0 },
|
||||
"end": { "line": 44, "column": 1, "offset": 340 }
|
||||
}
|
||||
}
|
@ -0,0 +1,385 @@
|
||||
{
|
||||
"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": 2,
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "--text--",
|
||||
"position": {
|
||||
"start": { "line": 17, "column": 4, "offset": 122 },
|
||||
"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": "text",
|
||||
"value": "Question line 1",
|
||||
"position": {
|
||||
"start": { "line": 19, "column": 1, "offset": 132 },
|
||||
"end": { "line": 19, "column": 16, "offset": 147 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 19, "column": 1, "offset": 132 },
|
||||
"end": { "line": 19, "column": 16, "offset": 147 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"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 },
|
||||
"indent": [1, 1]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "heading",
|
||||
"depth": 1,
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "--question--",
|
||||
"position": {
|
||||
"start": { "line": 25, "column": 3, "offset": 177 },
|
||||
"end": { "line": 25, "column": 15, "offset": 189 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 25, "column": 1, "offset": 175 },
|
||||
"end": { "line": 25, "column": 15, "offset": 189 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "heading",
|
||||
"depth": 2,
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "--answers--",
|
||||
"position": {
|
||||
"start": { "line": 27, "column": 4, "offset": 194 },
|
||||
"end": { "line": 27, "column": 15, "offset": 205 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 27, "column": 1, "offset": 191 },
|
||||
"end": { "line": 27, "column": 15, "offset": 205 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Some inline ",
|
||||
"position": {
|
||||
"start": { "line": 29, "column": 1, "offset": 207 },
|
||||
"end": { "line": 29, "column": 13, "offset": 219 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "inlineCode",
|
||||
"value": "code",
|
||||
"position": {
|
||||
"start": { "line": 29, "column": 13, "offset": 219 },
|
||||
"end": { "line": 29, "column": 19, "offset": 225 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 29, "column": 1, "offset": 207 },
|
||||
"end": { "line": 29, "column": 19, "offset": 225 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "thematicBreak",
|
||||
"position": {
|
||||
"start": { "line": 31, "column": 1, "offset": 227 },
|
||||
"end": { "line": 31, "column": 4, "offset": 230 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Some ",
|
||||
"position": {
|
||||
"start": { "line": 33, "column": 1, "offset": 232 },
|
||||
"end": { "line": 33, "column": 6, "offset": 237 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "emphasis",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "italics",
|
||||
"position": {
|
||||
"start": { "line": 33, "column": 7, "offset": 238 },
|
||||
"end": { "line": 33, "column": 14, "offset": 245 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 33, "column": 6, "offset": 237 },
|
||||
"end": { "line": 33, "column": 15, "offset": 246 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 33, "column": 1, "offset": 232 },
|
||||
"end": { "line": 33, "column": 15, "offset": 246 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "A second answer paragraph.",
|
||||
"position": {
|
||||
"start": { "line": 35, "column": 1, "offset": 248 },
|
||||
"end": { "line": 35, "column": 27, "offset": 274 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 35, "column": 1, "offset": 248 },
|
||||
"end": { "line": 35, "column": 27, "offset": 274 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "thematicBreak",
|
||||
"position": {
|
||||
"start": { "line": 37, "column": 1, "offset": 276 },
|
||||
"end": { "line": 37, "column": 4, "offset": 279 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"position": {
|
||||
"start": { "line": 39, "column": 1, "offset": 281 },
|
||||
"end": { "line": 39, "column": 33, "offset": 313 },
|
||||
"indent": []
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "html",
|
||||
"value": "<code>",
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 1, "offset": 0 },
|
||||
"end": { "line": 1, "column": 7, "offset": 6 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": " code in ",
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 7, "offset": 6 },
|
||||
"end": { "line": 1, "column": 16, "offset": 15 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "html",
|
||||
"value": "</code>",
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 16, "offset": 15 },
|
||||
"end": { "line": 1, "column": 23, "offset": 22 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": " code tags",
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 23, "offset": 22 },
|
||||
"end": { "line": 1, "column": 33, "offset": 32 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "heading",
|
||||
"depth": 2,
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "--video-solution--",
|
||||
"position": {
|
||||
"start": { "line": 41, "column": 4, "offset": 318 },
|
||||
"end": { "line": 41, "column": 22, "offset": 336 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 41, "column": 1, "offset": 315 },
|
||||
"end": { "line": 41, "column": 22, "offset": 336 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "3",
|
||||
"position": {
|
||||
"start": { "line": 43, "column": 1, "offset": 338 },
|
||||
"end": { "line": 43, "column": 2, "offset": 339 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 43, "column": 1, "offset": 338 },
|
||||
"end": { "line": 43, "column": 2, "offset": 339 },
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": { "line": 1, "column": 1, "offset": 0 },
|
||||
"end": { "line": 44, "column": 1, "offset": 340 }
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
{
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
1072
tools/challenge-parser/parser/__fixtures__/ast-with-jsx.json
Normal file
1072
tools/challenge-parser/parser/__fixtures__/ast-with-jsx.json
Normal file
File diff suppressed because it is too large
Load Diff
533
tools/challenge-parser/parser/__fixtures__/ast-with-markers.json
Normal file
533
tools/challenge-parser/parser/__fixtures__/ast-with-markers.json
Normal file
@ -0,0 +1,533 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,333 @@
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<html>\n <body>\n </body>\n</html>",
|
||||
"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 }
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
# comp title
|
||||
|
||||
some different text
|
||||
|
||||
# another title
|
5
tools/challenge-parser/parser/__fixtures__/document.md
Normal file
5
tools/challenge-parser/parser/__fixtures__/document.md
Normal file
@ -0,0 +1,5 @@
|
||||
# comp title
|
||||
|
||||
some text
|
||||
|
||||
# another title
|
@ -0,0 +1,59 @@
|
||||
::import{component="Script" from="./script.md" }
|
||||
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
::id{#test-id-1}
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
::id{#test-id-2}
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
|
||||
# --seed--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
::id{#custom-name}
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
::use{component="Script"}
|
182
tools/challenge-parser/parser/__fixtures__/realistic.md
Normal file
182
tools/challenge-parser/parser/__fixtures__/realistic.md
Normal file
@ -0,0 +1,182 @@
|
||||
# --description--
|
||||
|
||||
When you add a lower rank heading element to the page, it's implied that you're starting a new subsection.
|
||||
|
||||
After the last <code>h2</code> element of the second `section` element, add an `h3` element with the text `Things cats love:`.
|
||||
|
||||
<blockquote>
|
||||
<p>Some text in a blockquote</p>
|
||||
<p>
|
||||
Some text in a blockquote, with <code>code</code>
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
# --instructions--
|
||||
|
||||
Do something with the `code`.
|
||||
|
||||
To test that adjacent tags are handled correctly:
|
||||
|
||||
a bit of <code>code</code> <tag>with more after a space</tag> and another pair of <strong>elements</strong> <em>with a space</em>
|
||||
|
||||
# --hints--
|
||||
|
||||
The second `section` element appears to be missing or does not have both an opening and closing tag.
|
||||
|
||||
```js
|
||||
assert(
|
||||
document.querySelectorAll('main > section')[1] &&
|
||||
code.match(/\<\/section>/g).length == 2
|
||||
);
|
||||
```
|
||||
|
||||
There should be an `h3` element right above the second `section` element's closing tag.
|
||||
|
||||
```js
|
||||
assert(
|
||||
document.querySelectorAll('main > section')[1].lastElementChild.nodeName ===
|
||||
'H3'
|
||||
);
|
||||
```
|
||||
|
||||
The `h3` element right above the second `section` element's closing tag should have the text `Things cats love:`. Make sure to include the colon at the end of the text.
|
||||
|
||||
```js
|
||||
assert(
|
||||
document
|
||||
.querySelectorAll('main > section')[1]
|
||||
.lastElementChild.innerText.toLowerCase()
|
||||
.replace(/\s+/g, ' ') === 'things cats love:'
|
||||
);
|
||||
```
|
||||
|
||||
There should be an `h2` element with the text `Cat Lists` above the last `h3` element that is nested in the last `section` element'. You may have accidentally deleted the `h2` element.
|
||||
|
||||
```js
|
||||
const secondSectionLastElemNode = document.querySelectorAll('main > section')[1]
|
||||
.lastElementChild;
|
||||
assert(
|
||||
secondSectionLastElemNode.nodeName === 'H3' &&
|
||||
secondSectionLastElemNode.previousElementSibling.innerText
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, ' ') === 'cat lists'
|
||||
);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --before-user-code--
|
||||
|
||||
```js
|
||||
// this runs before the user's code is evaluated.
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
<h1>CatPhotoApp</h1>
|
||||
<main>
|
||||
<section>
|
||||
<h2>Cat Photos</h2>
|
||||
<!-- TODO: Add link to cat photos -->
|
||||
<p>
|
||||
Click here to view more
|
||||
<a target="_blank" href="https://www.freecodecamp.org/cat-photos"
|
||||
>cat photos</a
|
||||
>.
|
||||
</p>
|
||||
<a href="https://www.freecodecamp.org/cat-photos"
|
||||
><img
|
||||
src="https://bit.ly/fcc-relaxing-cat"
|
||||
alt="A cute orange cat lying on its back."
|
||||
/></a>
|
||||
</section>
|
||||
--fcc-editable-region--
|
||||
<section>
|
||||
<h2>Cat Lists</h2>
|
||||
</section>
|
||||
--fcc-editable-region--
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 20px;
|
||||
}
|
||||
--fcc-editable-region--
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
a {
|
||||
color: green;
|
||||
}
|
||||
```
|
||||
|
||||
::id{#final-key}
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
<h1>CatPhotoApp</h1>
|
||||
<main>
|
||||
<section>
|
||||
<h2>Cat Photos</h2>
|
||||
<!-- TODO: Add link to cat photos -->
|
||||
<p>
|
||||
Click here to view more
|
||||
<a target="_blank" href="https://www.freecodecamp.org/cat-photos"
|
||||
>cat photos</a
|
||||
>.
|
||||
</p>
|
||||
<a href="https://www.freecodecamp.org/cat-photos"
|
||||
><img
|
||||
src="https://bit.ly/fcc-relaxing-cat"
|
||||
alt="A cute orange cat lying on its back."
|
||||
/></a>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Cat Lists</h2>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
color: green;
|
||||
}
|
||||
```
|
||||
|
||||
::id{#final-key}
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
5
tools/challenge-parser/parser/__fixtures__/script-two.md
Normal file
5
tools/challenge-parser/parser/__fixtures__/script-two.md
Normal file
@ -0,0 +1,5 @@
|
||||
```css
|
||||
div {
|
||||
background: red
|
||||
}
|
||||
```
|
@ -0,0 +1,8 @@
|
||||
```js
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
const element = array[index];
|
||||
--fcc-editable-region--
|
||||
// imported from script.md
|
||||
--fcc-editable-region--
|
||||
}
|
||||
```
|
6
tools/challenge-parser/parser/__fixtures__/script.md
Normal file
6
tools/challenge-parser/parser/__fixtures__/script.md
Normal file
@ -0,0 +1,6 @@
|
||||
```js
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
const element = array[index];
|
||||
// imported from script.md
|
||||
}
|
||||
```
|
81
tools/challenge-parser/parser/__fixtures__/simple.md
Normal file
81
tools/challenge-parser/parser/__fixtures__/simple.md
Normal file
@ -0,0 +1,81 @@
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
Third *hint* with <code>code</code> and `inline code`
|
||||
|
||||
```js
|
||||
// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
``
|
@ -0,0 +1,107 @@
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
Third *hint* with <code>code</code> and `inline code`
|
||||
|
||||
```js
|
||||
// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --before-user-code--
|
||||
|
||||
```css
|
||||
body {
|
||||
etc: ''
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<!-- comment -->
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</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
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
``
|
@ -0,0 +1,73 @@
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
First hint
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
Third *hint* with <code>code</code> and `inline code`
|
||||
|
||||
|
||||
# --seed--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
``
|
68
tools/challenge-parser/parser/__fixtures__/with-c-code.md
Normal file
68
tools/challenge-parser/parser/__fixtures__/with-c-code.md
Normal file
@ -0,0 +1,68 @@
|
||||
# --seed--
|
||||
|
||||
## --before-user-code--
|
||||
|
||||
```css
|
||||
body {
|
||||
etc: ''
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<!-- comment -->
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
```c
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
```css
|
||||
body {
|
||||
background: blue;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
function teardown(params) {
|
||||
// after
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
@ -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>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
Third *hint* with <code>code</code> and `inline code`
|
||||
|
||||
```js
|
||||
// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
--fcc-editable-region--
|
||||
background: green;
|
||||
|
||||
--fcc-editable-region--
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
@ -0,0 +1,44 @@
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
--fcc-editable-region--
|
||||
background: white;
|
||||
--fcc-editable-region--
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
@ -0,0 +1,51 @@
|
||||
---
|
||||
id: bd7123c8c441eddfaeb5bdef
|
||||
title: Say Hello to HTML Elements
|
||||
challengeType: 0
|
||||
isHidden: false
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cE8Gpt2'
|
||||
forumTopicId: 18276
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
86
tools/challenge-parser/parser/__fixtures__/with-gfm.md
Normal file
86
tools/challenge-parser/parser/__fixtures__/with-gfm.md
Normal file
@ -0,0 +1,86 @@
|
||||
# --description--
|
||||
|
||||
Paragraph 1 ~~Strikethrough text~~. https://should.not.be.autolinked
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
| example | of a |
|
||||
| --- | --- |
|
||||
| gfm | table |
|
||||
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
Third *hint* with <code>code</code> and `inline code`
|
||||
|
||||
```js
|
||||
// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
``
|
@ -0,0 +1,60 @@
|
||||
::import{component="Script" from="./script.md" }
|
||||
::import{component="Second" from="./script-two.md" }
|
||||
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
::use{component="Second"}
|
||||
|
||||
::id{#custom-name}
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
::use{component="Script"}
|
58
tools/challenge-parser/parser/__fixtures__/with-imports.md
Normal file
58
tools/challenge-parser/parser/__fixtures__/with-imports.md
Normal file
@ -0,0 +1,58 @@
|
||||
::import{component="Script" from="./script.md" }
|
||||
::import{component="Second" from="./script-two.md" }
|
||||
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
::id{#custom-name}
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
::use{component="Script"}
|
@ -0,0 +1,57 @@
|
||||
::import{component="Script" from="./script-with-markers.md" }
|
||||
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
::id{#custom-name}
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
::use{component="Script"}
|
@ -0,0 +1,3 @@
|
||||
# --description--
|
||||
|
||||
<code> code in </code> code tags *emphasis* followed by <div><span>some nested html </span></div>
|
@ -0,0 +1,88 @@
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
Third *hint* with <code>code</code> and `inline code`
|
||||
|
||||
```js
|
||||
// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --before-user-code--
|
||||
|
||||
```css
|
||||
body {
|
||||
etc: ''
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<!-- comment -->
|
||||
```
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
```css
|
||||
body {
|
||||
background: blue;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
function teardown(params) {
|
||||
// after
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
``
|
@ -0,0 +1,111 @@
|
||||
# --seed--
|
||||
|
||||
## --before-user-code--
|
||||
|
||||
```css
|
||||
body {
|
||||
etc: ''
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<!-- comment -->
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</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
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
solution number two
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
::id{#html-key}
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y3';
|
||||
```
|
@ -0,0 +1,24 @@
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
::id{#key-for-css}
|
||||
|
||||
::id{#key-for-js}
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
@ -0,0 +1,27 @@
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
::id{#key-for-css}
|
||||
|
||||
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
::id{#key-for-js}
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
@ -0,0 +1,18 @@
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
::id{#key-for-html}
|
24
tools/challenge-parser/parser/__fixtures__/with-seed-keys.md
Normal file
24
tools/challenge-parser/parser/__fixtures__/with-seed-keys.md
Normal file
@ -0,0 +1,24 @@
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
::id{#key-for-css}
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
::id{#key-for-js}
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
@ -0,0 +1,43 @@
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
## --text--
|
||||
|
||||
Question line 1
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
# --question--
|
||||
|
||||
## --answers--
|
||||
|
||||
Some inline `code`
|
||||
|
||||
---
|
||||
|
||||
Some *italics*
|
||||
|
||||
A second answer paragraph.
|
||||
|
||||
---
|
||||
|
||||
<code> code in </code> code tags
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
@ -0,0 +1,43 @@
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --question--
|
||||
|
||||
## --text--
|
||||
|
||||
Question line 1
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
Some inline `code`
|
||||
|
||||
---
|
||||
|
||||
Some *italics*
|
||||
|
||||
A second answer paragraph.
|
||||
|
||||
---
|
||||
|
||||
<code> code in </code> code tags
|
||||
|
||||
## --video-solution--
|
||||
|
||||
3
|
56
tools/challenge-parser/parser/__fixtures__/with-yaml.md
Normal file
56
tools/challenge-parser/parser/__fixtures__/with-yaml.md
Normal file
@ -0,0 +1,56 @@
|
||||
# --description--
|
||||
|
||||
Paragraph 1
|
||||
|
||||
```html
|
||||
code example
|
||||
```
|
||||
|
||||
```yaml
|
||||
key:
|
||||
- subkey: value
|
||||
anothersubkey: another value
|
||||
```
|
||||
|
||||
# --instructions--
|
||||
|
||||
Paragraph 0
|
||||
|
||||
```html
|
||||
code example 0
|
||||
```
|
||||
|
||||
# --hints--
|
||||
|
||||
First hint
|
||||
|
||||
```js
|
||||
// test code
|
||||
```
|
||||
|
||||
Second hint with <code>code</code>
|
||||
|
||||
```js
|
||||
// more test code
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
body {
|
||||
background: green;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
var x = 'y';
|
||||
```
|
@ -0,0 +1,657 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`challenge parser it should parse video questions 1`] = `
|
||||
Object {
|
||||
"description": "<section id=\\"description\\">
|
||||
<p>Paragraph 1</p>
|
||||
<pre><code class=\\"language-html\\">code example
|
||||
</code></pre>
|
||||
</section>",
|
||||
"instructions": "<section id=\\"instructions\\">
|
||||
<p>Paragraph 0</p>
|
||||
<pre><code class=\\"language-html\\">code example 0
|
||||
</code></pre>
|
||||
</section>",
|
||||
"question": Object {
|
||||
"answers": Array [
|
||||
"<p>Some inline <code>code</code></p>",
|
||||
"<p>Some <em>italics</em></p>
|
||||
<p>A second answer paragraph.</p>",
|
||||
"<p><code> code in </code> code tags</p>",
|
||||
],
|
||||
"solution": 3,
|
||||
"text": "<p>Question line 1</p>
|
||||
<pre><code class=\\"language-js\\"> var x = 'y';
|
||||
</code></pre>",
|
||||
},
|
||||
"solutions": Array [
|
||||
Object {},
|
||||
],
|
||||
"tests": Array [],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`challenge parser should import md from other files 1`] = `
|
||||
Object {
|
||||
"description": "<section id=\\"description\\">
|
||||
<p>Paragraph 1</p>
|
||||
<pre><code class=\\"language-html\\">code example
|
||||
</code></pre>
|
||||
</section>",
|
||||
"files": Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: green;
|
||||
}",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
const element = array[index];
|
||||
// imported from script.md
|
||||
}",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "custom-name",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
"instructions": "<section id=\\"instructions\\">
|
||||
<p>Paragraph 0</p>
|
||||
<pre><code class=\\"language-html\\">code example 0
|
||||
</code></pre>
|
||||
</section>",
|
||||
"solutions": Array [
|
||||
Object {},
|
||||
],
|
||||
"tests": Array [
|
||||
Object {
|
||||
"testString": "// test code",
|
||||
"text": "<p>First hint</p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "// more test code",
|
||||
"text": "<p>Second hint with <code>code</code></p>",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`challenge parser should not mix other YAML with the frontmatter 1`] = `
|
||||
Object {
|
||||
"description": "<section id=\\"description\\">
|
||||
<p>Paragraph 1</p>
|
||||
<pre><code class=\\"language-html\\">code example
|
||||
</code></pre>
|
||||
<pre><code class=\\"language-yaml\\">key:
|
||||
- subkey: value
|
||||
anothersubkey: another value
|
||||
</code></pre>
|
||||
</section>",
|
||||
"files": Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: green;
|
||||
}",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
"instructions": "<section id=\\"instructions\\">
|
||||
<p>Paragraph 0</p>
|
||||
<pre><code class=\\"language-html\\">code example 0
|
||||
</code></pre>
|
||||
</section>",
|
||||
"solutions": Array [
|
||||
Object {},
|
||||
],
|
||||
"tests": Array [
|
||||
Object {
|
||||
"testString": "// test code",
|
||||
"text": "<p>First hint</p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "// more test code",
|
||||
"text": "<p>Second hint with <code>code</code></p>",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`challenge parser should parse a more realistic md file 1`] = `
|
||||
Object {
|
||||
"description": "<section id=\\"description\\">
|
||||
<p>When you add a lower rank heading element to the page, it's implied that you're starting a new subsection.</p>
|
||||
<p>After the last <code>h2</code> element of the second <code>section</code> element, add an <code>h3</code> element with the text <code>Things cats love:</code>.</p>
|
||||
<blockquote>
|
||||
<p>Some text in a blockquote</p>
|
||||
<p>
|
||||
Some text in a blockquote, with <code>code</code>
|
||||
</p>
|
||||
</blockquote>
|
||||
</section>",
|
||||
"files": Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: white;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
color: green;
|
||||
}",
|
||||
"editableRegionBoundaries": Array [
|
||||
7,
|
||||
9,
|
||||
],
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
<h1>CatPhotoApp</h1>
|
||||
<main>
|
||||
<section>
|
||||
<h2>Cat Photos</h2>
|
||||
<!-- TODO: Add link to cat photos -->
|
||||
<p>
|
||||
Click here to view more
|
||||
<a target=\\"_blank\\" href=\\"https://www.freecodecamp.org/cat-photos\\"
|
||||
>cat photos</a
|
||||
>.
|
||||
</p>
|
||||
<a href=\\"https://www.freecodecamp.org/cat-photos\\"
|
||||
><img
|
||||
src=\\"https://bit.ly/fcc-relaxing-cat\\"
|
||||
alt=\\"A cute orange cat lying on its back.\\"
|
||||
/></a>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Cat Lists</h2>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>",
|
||||
"editableRegionBoundaries": Array [
|
||||
19,
|
||||
23,
|
||||
],
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "html-key",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "js",
|
||||
"head": " // this runs before the user's code is evaluated.",
|
||||
"id": "final-key",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
"instructions": "<section id=\\"instructions\\">
|
||||
<p>Do something with the <code>code</code>.</p>
|
||||
<p>To test that adjacent tags are handled correctly:</p>
|
||||
<p>a bit of <code>code</code> <tag>with more after a space</tag> and another pair of <strong>elements</strong> <em>with a space</em></p>
|
||||
</section>",
|
||||
"solutions": Array [
|
||||
Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: white;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
color: green;
|
||||
}",
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
<h1>CatPhotoApp</h1>
|
||||
<main>
|
||||
<section>
|
||||
<h2>Cat Photos</h2>
|
||||
<!-- TODO: Add link to cat photos -->
|
||||
<p>
|
||||
Click here to view more
|
||||
<a target=\\"_blank\\" href=\\"https://www.freecodecamp.org/cat-photos\\"
|
||||
>cat photos</a
|
||||
>.
|
||||
</p>
|
||||
<a href=\\"https://www.freecodecamp.org/cat-photos\\"
|
||||
><img
|
||||
src=\\"https://bit.ly/fcc-relaxing-cat\\"
|
||||
alt=\\"A cute orange cat lying on its back.\\"
|
||||
/></a>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Cat Lists</h2>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>",
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "html-key",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';",
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "final-key",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
],
|
||||
"tests": Array [
|
||||
Object {
|
||||
"testString": "assert(
|
||||
document.querySelectorAll('main > section')[1] &&
|
||||
code.match(/\\\\<\\\\/section>/g).length == 2
|
||||
);",
|
||||
"text": "<p>The second <code>section</code> element appears to be missing or does not have both an opening and closing tag.</p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "assert(
|
||||
document.querySelectorAll('main > section')[1].lastElementChild.nodeName ===
|
||||
'H3'
|
||||
);",
|
||||
"text": "<p>There should be an <code>h3</code> element right above the second <code>section</code> element's closing tag.</p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "assert(
|
||||
document
|
||||
.querySelectorAll('main > section')[1]
|
||||
.lastElementChild.innerText.toLowerCase()
|
||||
.replace(/\\\\s+/g, ' ') === 'things cats love:'
|
||||
);",
|
||||
"text": "<p>The <code>h3</code> element right above the second <code>section</code> element's closing tag should have the text <code>Things cats love:</code>. Make sure to include the colon at the end of the text.</p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "const secondSectionLastElemNode = document.querySelectorAll('main > section')[1]
|
||||
.lastElementChild;
|
||||
assert(
|
||||
secondSectionLastElemNode.nodeName === 'H3' &&
|
||||
secondSectionLastElemNode.previousElementSibling.innerText
|
||||
.toLowerCase()
|
||||
.replace(/\\\\s+/g, ' ') === 'cat lists'
|
||||
);",
|
||||
"text": "<p>There should be an <code>h2</code> element with the text <code>Cat Lists</code> above the last <code>h3</code> element that is nested in the last <code>section</code> element'. You may have accidentally deleted the <code>h2</code> element.</p>",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`challenge parser should parse a simple md file 1`] = `
|
||||
Object {
|
||||
"description": "<section id=\\"description\\">
|
||||
<p>Paragraph 1</p>
|
||||
<pre><code class=\\"language-html\\">code example
|
||||
</code></pre>
|
||||
</section>",
|
||||
"files": Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: green;
|
||||
}",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
"instructions": "<section id=\\"instructions\\">
|
||||
<p>Paragraph 0</p>
|
||||
<pre><code class=\\"language-html\\">code example 0
|
||||
</code></pre>
|
||||
</section>",
|
||||
"solutions": Array [
|
||||
Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: white;
|
||||
}",
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "html-key",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';
|
||||
\`\`",
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
],
|
||||
"tests": Array [
|
||||
Object {
|
||||
"testString": "// test code",
|
||||
"text": "<p>First hint</p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "// more test code",
|
||||
"text": "<p>Second hint with <code>code</code></p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}",
|
||||
"text": "<p>Third <em>hint</em> with <code>code</code> and <code>inline code</code></p>",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`challenge parser should parse frontmatter 1`] = `
|
||||
Object {
|
||||
"challengeType": 0,
|
||||
"description": "<section id=\\"description\\">
|
||||
<p>Paragraph 1</p>
|
||||
<pre><code class=\\"language-html\\">code example
|
||||
</code></pre>
|
||||
</section>",
|
||||
"files": Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: green;
|
||||
}",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
"forumTopicId": 18276,
|
||||
"id": "bd7123c8c441eddfaeb5bdef",
|
||||
"isHidden": false,
|
||||
"solutions": Array [
|
||||
Object {},
|
||||
],
|
||||
"tests": Array [
|
||||
Object {
|
||||
"testString": "// test code",
|
||||
"text": "<p>First hint</p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "// more test code",
|
||||
"text": "<p>Second hint with <code>code</code></p>",
|
||||
},
|
||||
],
|
||||
"title": "Say Hello to HTML Elements",
|
||||
"videoUrl": "https://scrimba.com/p/pVMPUv/cE8Gpt2",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`challenge parser should parse gfm strikethrough and frontmatter 1`] = `
|
||||
Object {
|
||||
"description": "<section id=\\"description\\">
|
||||
<p>Paragraph 1 <del>Strikethrough text</del>. https://should.not.be.autolinked</p>
|
||||
<pre><code class=\\"language-html\\">code example
|
||||
</code></pre>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>example</th>
|
||||
<th>of a</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>gfm</td>
|
||||
<td>table</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>",
|
||||
"files": Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: green;
|
||||
}",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
"instructions": "<section id=\\"instructions\\">
|
||||
<p>Paragraph 0</p>
|
||||
<pre><code class=\\"language-html\\">code example 0
|
||||
</code></pre>
|
||||
</section>",
|
||||
"solutions": Array [
|
||||
Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: white;
|
||||
}",
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "html-key",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';
|
||||
\`\`",
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
],
|
||||
"tests": Array [
|
||||
Object {
|
||||
"testString": "// test code",
|
||||
"text": "<p>First hint</p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "// more test code",
|
||||
"text": "<p>Second hint with <code>code</code></p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}",
|
||||
"text": "<p>Third <em>hint</em> with <code>code</code> and <code>inline code</code></p>",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
56
tools/challenge-parser/parser/index.acceptance.test.js
Normal file
56
tools/challenge-parser/parser/index.acceptance.test.js
Normal file
@ -0,0 +1,56 @@
|
||||
/* global expect */
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const { parseMD } = require('.');
|
||||
|
||||
describe('challenge parser', () => {
|
||||
it('should parse a simple md file', async () => {
|
||||
const parsed = await parseMD(
|
||||
path.resolve(__dirname, '__fixtures__/simple.md')
|
||||
);
|
||||
expect(parsed).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should parse a more realistic md file', async () => {
|
||||
const parsed = await parseMD(
|
||||
path.resolve(__dirname, '__fixtures__/realistic.md')
|
||||
);
|
||||
expect(parsed).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should import md from other files', async () => {
|
||||
const parsed = await parseMD(
|
||||
path.resolve(__dirname, '__fixtures__/with-imports.md')
|
||||
);
|
||||
expect(parsed).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should parse frontmatter', async () => {
|
||||
const parsed = await parseMD(
|
||||
path.resolve(__dirname, '__fixtures__/with-frontmatter.md')
|
||||
);
|
||||
expect(parsed).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should parse gfm strikethrough and frontmatter', async () => {
|
||||
const parsed = await parseMD(
|
||||
path.resolve(__dirname, '__fixtures__/with-gfm.md')
|
||||
);
|
||||
expect(parsed).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should not mix other YAML with the frontmatter', async () => {
|
||||
const parsed = await parseMD(
|
||||
path.resolve(__dirname, '__fixtures__/with-yaml.md')
|
||||
);
|
||||
expect(parsed).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('it should parse video questions', async () => {
|
||||
const parsed = await parseMD(
|
||||
path.resolve(__dirname, '__fixtures__/with-video-question.md')
|
||||
);
|
||||
expect(parsed).toMatchSnapshot();
|
||||
});
|
||||
});
|
58
tools/challenge-parser/parser/index.js
Normal file
58
tools/challenge-parser/parser/index.js
Normal file
@ -0,0 +1,58 @@
|
||||
const { readSync } = require('to-vfile');
|
||||
const remark = require('remark-parse');
|
||||
const directive = require('remark-directive');
|
||||
const frontmatter = require('remark-frontmatter');
|
||||
const addTests = require('./plugins/add-tests');
|
||||
const replaceImports = require('./plugins/replace-imports');
|
||||
const addFrontmatter = require('./plugins/add-frontmatter');
|
||||
const addText = require('./plugins/add-text');
|
||||
const addVideoQuestion = require('./plugins/add-video-question');
|
||||
const addSeed = require('./plugins/add-seed');
|
||||
const addSolution = require('./plugins/add-solution');
|
||||
const tableAndStrikeThrough = require('./plugins/table-and-strikethrough');
|
||||
const unified = require('unified');
|
||||
|
||||
// by convention, anything that adds to file.data has the name add<name>.
|
||||
const processor = unified()
|
||||
// add the remark parser
|
||||
.use(remark)
|
||||
// modify the parser so that Github flavour tables and strikethroughs get
|
||||
// converted to 'delete' nodes
|
||||
.use(tableAndStrikeThrough)
|
||||
// directives are parsed into 'leafDirective' nodes and used for imports
|
||||
.use(directive)
|
||||
// convert the text at the top of the document (surrounded by ---) into a
|
||||
// 'yaml' node
|
||||
.use(frontmatter, ['yaml'])
|
||||
// extract the content from that 'yaml' node
|
||||
.use(addFrontmatter)
|
||||
// Any imports will be replaced (in the tree) with
|
||||
// the sub-tree of the target file. e.g.
|
||||
// ::import{component="Script" from="./file.path" }
|
||||
// means that file.path's tree will be inserted wherever
|
||||
// ::use{component="Script"}
|
||||
// appears.
|
||||
.use(replaceImports)
|
||||
// the final five plugins insert content into file.data
|
||||
.use(addText, ['description', 'instructions'])
|
||||
// TODO: rename test->hint everywhere? It should make things easier to reason
|
||||
// about.
|
||||
.use(addTests)
|
||||
.use(addVideoQuestion)
|
||||
.use(addSeed)
|
||||
.use(addSolution);
|
||||
|
||||
exports.parseMD = function parseMD(filename) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const file = readSync(filename);
|
||||
const tree = processor.parse(file);
|
||||
processor.run(tree, file, function(err, node, file) {
|
||||
if (err) {
|
||||
err.message += ' in file ' + filename;
|
||||
reject(err);
|
||||
}
|
||||
delete file.contents;
|
||||
return resolve(file.data);
|
||||
});
|
||||
});
|
||||
};
|
997
tools/challenge-parser/parser/package-lock.json
generated
Normal file
997
tools/challenge-parser/parser/package-lock.json
generated
Normal file
@ -0,0 +1,997 @@
|
||||
{
|
||||
"name": "challenge-mdx-parser",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/mdast": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.3.tgz",
|
||||
"integrity": "sha512-SXPBMnFVQg1s00dlMCc/jCdvPqdE4mXaMMCeRlxLDmTAEoegHT53xKtkDnzDTOcmMHUfcjyf36/YYZ6SxRdnsw==",
|
||||
"requires": {
|
||||
"@types/unist": "*"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.11.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.10.tgz",
|
||||
"integrity": "sha512-yV1nWZPlMFpoXyoknm4S56y2nlTAuFYaJuQtYRAOU7xA/FJ9RY0Xm7QOkaYMMmr8ESdHIuUb6oQgR/0+2NqlyA=="
|
||||
},
|
||||
"@types/unist": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.3.tgz",
|
||||
"integrity": "sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ=="
|
||||
},
|
||||
"@types/vfile": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/vfile/-/vfile-3.0.2.tgz",
|
||||
"integrity": "sha512-b3nLFGaGkJ9rzOcuXRfHkZMdjsawuDD0ENL9fzTophtBg8FJHSGbH7daXkEpcwy3v7Xol3pAvsmlYyFhR4pqJw==",
|
||||
"requires": {
|
||||
"@types/node": "*",
|
||||
"@types/unist": "*",
|
||||
"@types/vfile-message": "*"
|
||||
}
|
||||
},
|
||||
"@types/vfile-message": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/vfile-message/-/vfile-message-2.0.0.tgz",
|
||||
"integrity": "sha512-GpTIuDpb9u4zIO165fUy9+fXcULdD8HFRNli04GehoMVbeNq7D6OBnqSmg3lxZnC+UvgUhEWKxdKiwYUkGltIw==",
|
||||
"requires": {
|
||||
"vfile-message": "*"
|
||||
}
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"requires": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"array-iterate": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/array-iterate/-/array-iterate-1.1.4.tgz",
|
||||
"integrity": "sha512-sNRaPGh9nnmdC8Zf+pT3UqP8rnWj5Hf9wiFGsX3wUQ2yVSIhO2ShFwCoceIPpB41QF6i2OEmrHmCo36xronCVA=="
|
||||
},
|
||||
"bail": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz",
|
||||
"integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ=="
|
||||
},
|
||||
"boolbase": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
|
||||
"dev": true
|
||||
},
|
||||
"ccount": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.5.tgz",
|
||||
"integrity": "sha512-MOli1W+nfbPLlKEhInaxhRdp7KVLFxLN5ykwzHgLsLI3H3gs5jjFAK4Eoj3OzzcxCtumDaI8onoVDeQyWaNTkw=="
|
||||
},
|
||||
"character-entities": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz",
|
||||
"integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw=="
|
||||
},
|
||||
"character-entities-html4": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.4.tgz",
|
||||
"integrity": "sha512-HRcDxZuZqMx3/a+qrzxdBKBPUpxWEq9xw2OPZ3a/174ihfrQKVsFhqtthBInFy1zZ9GgZyFXOatNujm8M+El3g=="
|
||||
},
|
||||
"character-entities-legacy": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz",
|
||||
"integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA=="
|
||||
},
|
||||
"character-reference-invalid": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz",
|
||||
"integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg=="
|
||||
},
|
||||
"collapse-white-space": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.6.tgz",
|
||||
"integrity": "sha512-jEovNnrhMuqyCcjfEJA56v0Xq8SkIoPKDyaHahwo3POf4qcSXqMYuwNcOTzp74vTsR9Tn08z4MxWqAhcekogkQ=="
|
||||
},
|
||||
"comma-separated-tokens": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz",
|
||||
"integrity": "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw=="
|
||||
},
|
||||
"css-selector-parser": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-1.4.1.tgz",
|
||||
"integrity": "sha512-HYPSb7y/Z7BNDCOrakL4raGO2zltZkbeXyAd6Tg9obzix6QhzxCotdBl6VT0Dv4vZfJGVz3WL/xaEI9Ly3ul0g==",
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
|
||||
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
|
||||
},
|
||||
"fault": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz",
|
||||
"integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==",
|
||||
"requires": {
|
||||
"format": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"format": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz",
|
||||
"integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs="
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
|
||||
},
|
||||
"has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"hast-util-is-element": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-1.1.0.tgz",
|
||||
"integrity": "sha512-oUmNua0bFbdrD/ELDSSEadRVtWZOf3iF6Lbv81naqsIV99RnSCieTbWuWCY8BAeEfKJTKl0gRdokv+dELutHGQ=="
|
||||
},
|
||||
"hast-util-sanitize": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/hast-util-sanitize/-/hast-util-sanitize-3.0.0.tgz",
|
||||
"integrity": "sha512-gxsM24ARtuulsrWEj8QtVM6FNeAEHklF/t7TEIWvX1wuQcoAQtJtEUcT8t0os4uxCUqh1epX/gTi8fp8gNKvCA==",
|
||||
"requires": {
|
||||
"xtend": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"hast-util-to-html": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-7.1.1.tgz",
|
||||
"integrity": "sha512-Ujqj0hGuo3dIQKilkbauAv5teOqPvhaSLEgs1lgApFT0812e114KiffV8XfE4ttR8dRPqxNOIJOMu6SKOVOGlg==",
|
||||
"requires": {
|
||||
"ccount": "^1.0.0",
|
||||
"comma-separated-tokens": "^1.0.0",
|
||||
"hast-util-is-element": "^1.0.0",
|
||||
"hast-util-whitespace": "^1.0.0",
|
||||
"html-void-elements": "^1.0.0",
|
||||
"property-information": "^5.0.0",
|
||||
"space-separated-tokens": "^1.0.0",
|
||||
"stringify-entities": "^3.0.1",
|
||||
"unist-util-is": "^4.0.0",
|
||||
"xtend": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"property-information": {
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/property-information/-/property-information-5.6.0.tgz",
|
||||
"integrity": "sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==",
|
||||
"requires": {
|
||||
"xtend": "^4.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"hast-util-whitespace": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-1.0.4.tgz",
|
||||
"integrity": "sha512-I5GTdSfhYfAPNztx2xJRQpG8cuDSNt599/7YUn7Gx/WxNMsG+a835k97TDkFgk123cwjfwINaZknkKkphx/f2A=="
|
||||
},
|
||||
"html-void-elements": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-1.0.5.tgz",
|
||||
"integrity": "sha512-uE/TxKuyNIcx44cIWnjr/rfIATDH7ZaOMmstu0CwhFG1Dunhlp4OC6/NMbhiwoq5BpW0ubi303qnEk/PZj614w=="
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"is-alphabetical": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz",
|
||||
"integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg=="
|
||||
},
|
||||
"is-alphanumerical": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz",
|
||||
"integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==",
|
||||
"requires": {
|
||||
"is-alphabetical": "^1.0.0",
|
||||
"is-decimal": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-buffer": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
|
||||
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A=="
|
||||
},
|
||||
"is-decimal": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz",
|
||||
"integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw=="
|
||||
},
|
||||
"is-hexadecimal": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
|
||||
"integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw=="
|
||||
},
|
||||
"is-plain-obj": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
|
||||
"integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA=="
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "3.14.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz",
|
||||
"integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==",
|
||||
"requires": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.20",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
|
||||
},
|
||||
"lodash.iteratee": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.iteratee/-/lodash.iteratee-4.7.0.tgz",
|
||||
"integrity": "sha1-vkF32yiajMw8CZDx2ya1si/BVUw="
|
||||
},
|
||||
"longest-streak": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.4.tgz",
|
||||
"integrity": "sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg=="
|
||||
},
|
||||
"markdown-table": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz",
|
||||
"integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==",
|
||||
"requires": {
|
||||
"repeat-string": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"mdast-builder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/mdast-builder/-/mdast-builder-1.1.1.tgz",
|
||||
"integrity": "sha512-a3KBk/LmYD6wKsWi8WJrGU/rXR4yuF4Men0JO0z6dSZCm5FrXXWTRDjqK0vGSqa+1M6p9edeuypZAZAzSehTUw==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"mdast-util-definitions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-3.0.1.tgz",
|
||||
"integrity": "sha512-BAv2iUm/e6IK/b2/t+Fx69EL/AGcq/IG2S+HxHjDJGfLJtd6i9SZUS76aC9cig+IEucsqxKTR0ot3m933R3iuA==",
|
||||
"requires": {
|
||||
"unist-util-visit": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"mdast-util-directive": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-directive/-/mdast-util-directive-1.0.0.tgz",
|
||||
"integrity": "sha512-04nOvmHrQfcgPQDAn9x0gW05vhqXmkGPP9G7o8BE+7Oy16oyTAgJpJyVFTscPyEzfsP7p7LSKJAXWqTCBvPjuw==",
|
||||
"requires": {
|
||||
"mdast-util-to-markdown": "^0.5.0",
|
||||
"parse-entities": "^2.0.0",
|
||||
"repeat-string": "^1.0.0",
|
||||
"stringify-entities": "^3.1.0",
|
||||
"unist-util-visit-parents": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"unist-util-visit-parents": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz",
|
||||
"integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"unist-util-is": "^4.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mdast-util-from-markdown": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.0.tgz",
|
||||
"integrity": "sha512-x9b9ekG2IfeqHSUPhn4+o8SeXqual0/ZHzzugV/cC21L6s1KyKAwIHKBJ1NN9ZstIlY8YAefELRSWfJMby4a9Q==",
|
||||
"requires": {
|
||||
"@types/mdast": "^3.0.0",
|
||||
"mdast-util-to-string": "^1.0.0",
|
||||
"micromark": "~2.10.0",
|
||||
"parse-entities": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"mdast-util-frontmatter": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-frontmatter/-/mdast-util-frontmatter-0.2.0.tgz",
|
||||
"integrity": "sha512-FHKL4w4S5fdt1KjJCwB0178WJ0evnyyQr5kXTM3wrOVpytD0hrkvd+AOOjU9Td8onOejCkmZ+HQRT3CZ3coHHQ==",
|
||||
"requires": {
|
||||
"micromark-extension-frontmatter": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"mdast-util-gfm": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.0.tgz",
|
||||
"integrity": "sha512-HLfygQL6HdhJhFbLta4Ki9hClrzyAxRjyRvpm5caN65QZL+NyHPmqFlnF9vm1Rn58JT2+AbLwNcEDY4MEvkk8Q==",
|
||||
"requires": {
|
||||
"mdast-util-gfm-autolink-literal": "^0.1.0",
|
||||
"mdast-util-gfm-strikethrough": "^0.2.0",
|
||||
"mdast-util-gfm-table": "^0.1.0",
|
||||
"mdast-util-gfm-task-list-item": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"mdast-util-gfm-autolink-literal": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.1.tgz",
|
||||
"integrity": "sha512-gJ2xSpqKCetSr22GEWpZH3f5ffb4pPn/72m4piY0v7T/S+O7n7rw+sfoPLhb2b4O7WdnERoYdALRcmD68FMtlw=="
|
||||
},
|
||||
"mdast-util-gfm-strikethrough": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.2.tgz",
|
||||
"integrity": "sha512-T37ZbaokJcRbHROXmoVAieWnesPD5N21tv2ifYzaGRLbkh1gknItUGhZzHefUn5Zc/eaO/iTDSAFOBrn/E8kWw==",
|
||||
"requires": {
|
||||
"mdast-util-to-markdown": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"mdast-util-gfm-table": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.4.tgz",
|
||||
"integrity": "sha512-T4xFSON9kUb/IpYA5N+KGWcsdGczAvILvKiXQwUGind6V9fvjPCR9yhZnIeaLdBWXaz3m/Gq77ZtuLMjtFR4IQ==",
|
||||
"requires": {
|
||||
"markdown-table": "^2.0.0",
|
||||
"mdast-util-to-markdown": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"mdast-util-gfm-task-list-item": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.3.tgz",
|
||||
"integrity": "sha512-9adbEPNB7oxvwiHErO6v+3D+YyM42G0LHCnBId8trm5mkvjsm8vt9zxo0yGZxih/8luk9uZq8Smf31sDIqrmkA==",
|
||||
"requires": {
|
||||
"mdast-util-to-markdown": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"mdast-util-to-hast": {
|
||||
"version": "9.1.2",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-9.1.2.tgz",
|
||||
"integrity": "sha512-OpkFLBC2VnNAb2FNKcKWu9FMbJhQKog+FCT8nuKmQNIKXyT1n3SIskE7uWDep6x+cA20QXlK5AETHQtYmQmxtQ==",
|
||||
"requires": {
|
||||
"@types/mdast": "^3.0.0",
|
||||
"@types/unist": "^2.0.0",
|
||||
"mdast-util-definitions": "^3.0.0",
|
||||
"mdurl": "^1.0.0",
|
||||
"unist-builder": "^2.0.0",
|
||||
"unist-util-generated": "^1.0.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"mdast-util-to-markdown": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.5.2.tgz",
|
||||
"integrity": "sha512-kPPJ98HguKsWuUgR1oVR7oyVIdcSmOEYPL2g0rGTkJLDJrV2JSEq+F6b+mPtpQCexmD7Vdd7MES34rQUGCIMTw==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"longest-streak": "^2.0.0",
|
||||
"mdast-util-to-string": "^1.0.0",
|
||||
"parse-entities": "^2.0.0",
|
||||
"repeat-string": "^1.0.0",
|
||||
"zwitch": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"mdast-util-to-string": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz",
|
||||
"integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A=="
|
||||
},
|
||||
"mdurl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
|
||||
"integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4="
|
||||
},
|
||||
"micromark": {
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/micromark/-/micromark-2.10.1.tgz",
|
||||
"integrity": "sha512-fUuVF8sC1X7wsCS29SYQ2ZfIZYbTymp0EYr6sab3idFjigFFjGa5UwoniPlV9tAgntjuapW1t9U+S0yDYeGKHQ==",
|
||||
"requires": {
|
||||
"debug": "^4.0.0",
|
||||
"parse-entities": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"micromark-extension-directive": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/micromark-extension-directive/-/micromark-extension-directive-1.0.0.tgz",
|
||||
"integrity": "sha512-6FjvznI5GpUysZqGtTEMeDaC/D3FdWFVc3CC5gDZB3fBtqiaIRBhCNg4fbqvrFSC0T2eqRbO2dJ7ZFU86gAtEQ==",
|
||||
"requires": {
|
||||
"micromark": "~2.10.0",
|
||||
"parse-entities": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"micromark-extension-frontmatter": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/micromark-extension-frontmatter/-/micromark-extension-frontmatter-0.2.2.tgz",
|
||||
"integrity": "sha512-q6nPLFCMTLtfsctAuS0Xh4vaolxSFUWUWR6PZSrXXiRy+SANGllpcqdXFv2z07l0Xz/6Hl40hK0ffNCJPH2n1A==",
|
||||
"requires": {
|
||||
"fault": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"micromark-extension-gfm-strikethrough": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.1.tgz",
|
||||
"integrity": "sha512-2+5qpceAqPysnjM0bpONY/3Jdnt7PJpns7rEtlwoThV2OOE7ReoQ07lYSAL8y/1sW5NnmF8XylvBdSlGsphEpQ==",
|
||||
"requires": {
|
||||
"micromark": "~2.10.0"
|
||||
}
|
||||
},
|
||||
"micromark-extension-gfm-table": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.1.tgz",
|
||||
"integrity": "sha512-xVpqOnfFaa2OtC/Y7rlt4tdVFlUHdoLH3RXAZgb/KP3DDyKsAOx6BRS3UxiiyvmD/p2l6VUpD4bMIniuP4o4JA==",
|
||||
"requires": {
|
||||
"micromark": "~2.10.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"not": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/not/-/not-0.1.0.tgz",
|
||||
"integrity": "sha1-yWkcF0bFXc++VMvYvU/wQbwrUZ0=",
|
||||
"dev": true
|
||||
},
|
||||
"nth-check": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
|
||||
"integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"boolbase": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"parse-entities": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz",
|
||||
"integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
|
||||
"requires": {
|
||||
"character-entities": "^1.0.0",
|
||||
"character-entities-legacy": "^1.0.0",
|
||||
"character-reference-invalid": "^1.0.0",
|
||||
"is-alphanumerical": "^1.0.0",
|
||||
"is-decimal": "^1.0.0",
|
||||
"is-hexadecimal": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"remark": {
|
||||
"version": "13.0.0",
|
||||
"resolved": "https://registry.npmjs.org/remark/-/remark-13.0.0.tgz",
|
||||
"integrity": "sha512-HDz1+IKGtOyWN+QgBiAT0kn+2s6ovOxHyPAFGKVE81VSzJ+mq7RwHFledEvB5F1p4iJvOah/LOKdFuzvRnNLCA==",
|
||||
"requires": {
|
||||
"remark-parse": "^9.0.0",
|
||||
"remark-stringify": "^9.0.0",
|
||||
"unified": "^9.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"remark-parse": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-9.0.0.tgz",
|
||||
"integrity": "sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==",
|
||||
"requires": {
|
||||
"mdast-util-from-markdown": "^0.8.0"
|
||||
}
|
||||
},
|
||||
"remark-stringify": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-9.0.0.tgz",
|
||||
"integrity": "sha512-8x29DpTbVzEc6Dwb90qhxCtbZ6hmj3BxWWDpMhA+1WM4dOEGH5U5/GFe3Be5Hns5MvPSFAr1e2KSVtKZkK5nUw==",
|
||||
"requires": {
|
||||
"mdast-util-to-markdown": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"unified": {
|
||||
"version": "9.2.0",
|
||||
"resolved": "https://registry.npmjs.org/unified/-/unified-9.2.0.tgz",
|
||||
"integrity": "sha512-vx2Z0vY+a3YoTj8+pttM3tiJHCwY5UFbYdiWrwBEbHmK8pvsPj2rtAX2BFfgXen8T39CJWblWRDT4L5WGXtDdg==",
|
||||
"requires": {
|
||||
"bail": "^1.0.0",
|
||||
"extend": "^3.0.0",
|
||||
"is-buffer": "^2.0.0",
|
||||
"is-plain-obj": "^2.0.0",
|
||||
"trough": "^1.0.0",
|
||||
"vfile": "^4.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"remark-directive": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/remark-directive/-/remark-directive-1.0.1.tgz",
|
||||
"integrity": "sha512-x6rZs0qa0zu9gW7Avd+rRxHJL2K9TGk+c51NaLfQgCNI7SxwBycRJ3w5mMkjkIjO6O9/qdx0ntu48byCSgF96Q==",
|
||||
"requires": {
|
||||
"mdast-util-directive": "^1.0.0",
|
||||
"micromark-extension-directive": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"remark-frontmatter": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-3.0.0.tgz",
|
||||
"integrity": "sha512-mSuDd3svCHs+2PyO29h7iijIZx4plX0fheacJcAoYAASfgzgVIcXGYSq9GFyYocFLftQs8IOmmkgtOovs6d4oA==",
|
||||
"requires": {
|
||||
"mdast-util-frontmatter": "^0.2.0",
|
||||
"micromark-extension-frontmatter": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"remark-html": {
|
||||
"version": "12.0.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-html/-/remark-html-12.0.0.tgz",
|
||||
"integrity": "sha512-M104NMHs48+uswChJkCDXCdabzxAinpHikpt6kS3gmGMyIvPZ5kn53tB9shFsL2O4HUJ9DIEsah1SX1Ve5FXHA==",
|
||||
"requires": {
|
||||
"hast-util-sanitize": "^3.0.0",
|
||||
"hast-util-to-html": "^7.0.0",
|
||||
"mdast-util-to-hast": "^9.0.0",
|
||||
"xtend": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"remark-parse": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-9.0.0.tgz",
|
||||
"integrity": "sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==",
|
||||
"requires": {
|
||||
"mdast-util-from-markdown": "^0.8.0"
|
||||
}
|
||||
},
|
||||
"repeat-string": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
|
||||
"integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc="
|
||||
},
|
||||
"replace-ext": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz",
|
||||
"integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs="
|
||||
},
|
||||
"space-separated-tokens": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz",
|
||||
"integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA=="
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
|
||||
},
|
||||
"stringify-entities": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-3.1.0.tgz",
|
||||
"integrity": "sha512-3FP+jGMmMV/ffZs86MoghGqAoqXAdxLrJP4GUdrDN1aIScYih5tuIO3eF4To5AJZ79KDZ8Fpdy7QJnK8SsL1Vg==",
|
||||
"requires": {
|
||||
"character-entities-html4": "^1.0.0",
|
||||
"character-entities-legacy": "^1.0.0",
|
||||
"xtend": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"to-vfile": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-5.0.3.tgz",
|
||||
"integrity": "sha512-z1Lfx60yAMDMmr+f426Y4yECsHdl8GVEAE+LymjRF5oOIZ7T4N20IxWNAxXLMRzP9jSSll38Z0fKVAhVLsdLOw==",
|
||||
"requires": {
|
||||
"is-buffer": "^2.0.0",
|
||||
"vfile": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"unist-util-stringify-position": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz",
|
||||
"integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ=="
|
||||
},
|
||||
"vfile": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/vfile/-/vfile-3.0.1.tgz",
|
||||
"integrity": "sha512-y7Y3gH9BsUSdD4KzHsuMaCzRjglXN0W2EcMf0gpvu6+SbsGhMje7xDc8AEoeXy6mIwCKMI6BkjMsRjzQbhMEjQ==",
|
||||
"requires": {
|
||||
"is-buffer": "^2.0.0",
|
||||
"replace-ext": "1.0.0",
|
||||
"unist-util-stringify-position": "^1.0.0",
|
||||
"vfile-message": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"vfile-message": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz",
|
||||
"integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==",
|
||||
"requires": {
|
||||
"unist-util-stringify-position": "^1.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"trim": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz",
|
||||
"integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0="
|
||||
},
|
||||
"trim-trailing-lines": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.3.tgz",
|
||||
"integrity": "sha512-4ku0mmjXifQcTVfYDfR5lpgV7zVqPg6zV9rdZmwOPqq0+Zq19xDqEgagqVbc4pOOShbncuAOIs59R3+3gcF3ZA=="
|
||||
},
|
||||
"trough": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz",
|
||||
"integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA=="
|
||||
},
|
||||
"unherit": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz",
|
||||
"integrity": "sha512-Ft16BJcnapDKp0+J/rqFC3Rrk6Y/Ng4nzsC028k2jdDII/rdZ7Wd3pPT/6+vIIxRagwRc9K0IUX0Ra4fKvw+WQ==",
|
||||
"requires": {
|
||||
"inherits": "^2.0.0",
|
||||
"xtend": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"unified": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/unified/-/unified-7.1.0.tgz",
|
||||
"integrity": "sha512-lbk82UOIGuCEsZhPj8rNAkXSDXd6p0QLzIuSsCdxrqnqU56St4eyOB+AlXsVgVeRmetPTYydIuvFfpDIed8mqw==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"@types/vfile": "^3.0.0",
|
||||
"bail": "^1.0.0",
|
||||
"extend": "^3.0.0",
|
||||
"is-plain-obj": "^1.1.0",
|
||||
"trough": "^1.0.0",
|
||||
"vfile": "^3.0.0",
|
||||
"x-is-string": "^0.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-plain-obj": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
|
||||
"integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4="
|
||||
},
|
||||
"unist-util-stringify-position": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz",
|
||||
"integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ=="
|
||||
},
|
||||
"vfile": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/vfile/-/vfile-3.0.1.tgz",
|
||||
"integrity": "sha512-y7Y3gH9BsUSdD4KzHsuMaCzRjglXN0W2EcMf0gpvu6+SbsGhMje7xDc8AEoeXy6mIwCKMI6BkjMsRjzQbhMEjQ==",
|
||||
"requires": {
|
||||
"is-buffer": "^2.0.0",
|
||||
"replace-ext": "1.0.0",
|
||||
"unist-util-stringify-position": "^1.0.0",
|
||||
"vfile-message": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"vfile-message": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz",
|
||||
"integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==",
|
||||
"requires": {
|
||||
"unist-util-stringify-position": "^1.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"unist-builder": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/unist-builder/-/unist-builder-2.0.3.tgz",
|
||||
"integrity": "sha512-f98yt5pnlMWlzP539tPc4grGMsFaQQlP/vM396b00jngsiINumNmsY8rkXjfoi1c6QaM8nQ3vaGDuoKWbe/1Uw=="
|
||||
},
|
||||
"unist-util-find": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-find/-/unist-util-find-1.0.1.tgz",
|
||||
"integrity": "sha1-EGK7tpKMepfGrcibU3RdTEbCIqI=",
|
||||
"requires": {
|
||||
"lodash.iteratee": "^4.5.0",
|
||||
"remark": "^5.0.1",
|
||||
"unist-util-visit": "^1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"longest-streak": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-1.0.0.tgz",
|
||||
"integrity": "sha1-0GWXxNTDG1LMsfXY+P5xSOr9aWU="
|
||||
},
|
||||
"markdown-table": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-0.4.0.tgz",
|
||||
"integrity": "sha1-iQwsGzv+g/sA5BKbjkz+ZFJw+dE="
|
||||
},
|
||||
"parse-entities": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz",
|
||||
"integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==",
|
||||
"requires": {
|
||||
"character-entities": "^1.0.0",
|
||||
"character-entities-legacy": "^1.0.0",
|
||||
"character-reference-invalid": "^1.0.0",
|
||||
"is-alphanumerical": "^1.0.0",
|
||||
"is-decimal": "^1.0.0",
|
||||
"is-hexadecimal": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"remark": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/remark/-/remark-5.1.0.tgz",
|
||||
"integrity": "sha1-y0Y709vLS5l5STXu4c9x16jjBow=",
|
||||
"requires": {
|
||||
"remark-parse": "^1.1.0",
|
||||
"remark-stringify": "^1.1.0",
|
||||
"unified": "^4.1.1"
|
||||
}
|
||||
},
|
||||
"remark-parse": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-1.1.0.tgz",
|
||||
"integrity": "sha1-w8oQ+ajaBGFcKPCapOMEUQUm7CE=",
|
||||
"requires": {
|
||||
"collapse-white-space": "^1.0.0",
|
||||
"extend": "^3.0.0",
|
||||
"parse-entities": "^1.0.2",
|
||||
"repeat-string": "^1.5.4",
|
||||
"trim": "0.0.1",
|
||||
"trim-trailing-lines": "^1.0.0",
|
||||
"unherit": "^1.0.4",
|
||||
"unist-util-remove-position": "^1.0.0",
|
||||
"vfile-location": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"remark-stringify": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-1.1.0.tgz",
|
||||
"integrity": "sha1-pxBeJbnuK/mkm3XSxCPxGwauIJI=",
|
||||
"requires": {
|
||||
"ccount": "^1.0.0",
|
||||
"extend": "^3.0.0",
|
||||
"longest-streak": "^1.0.0",
|
||||
"markdown-table": "^0.4.0",
|
||||
"parse-entities": "^1.0.2",
|
||||
"repeat-string": "^1.5.4",
|
||||
"stringify-entities": "^1.0.1",
|
||||
"unherit": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"stringify-entities": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.2.tgz",
|
||||
"integrity": "sha512-nrBAQClJAPN2p+uGCVJRPIPakKeKWZ9GtBCmormE7pWOSlHat7+x5A8gx85M7HM5Dt0BP3pP5RhVW77WdbJJ3A==",
|
||||
"requires": {
|
||||
"character-entities-html4": "^1.0.0",
|
||||
"character-entities-legacy": "^1.0.0",
|
||||
"is-alphanumerical": "^1.0.0",
|
||||
"is-hexadecimal": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"unified": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/unified/-/unified-4.2.1.tgz",
|
||||
"integrity": "sha1-dv9Dqo2kMPbn5KVchOusKtLPzS4=",
|
||||
"requires": {
|
||||
"bail": "^1.0.0",
|
||||
"extend": "^3.0.0",
|
||||
"has": "^1.0.1",
|
||||
"once": "^1.3.3",
|
||||
"trough": "^1.0.0",
|
||||
"vfile": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"unist-util-remove-position": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz",
|
||||
"integrity": "sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A==",
|
||||
"requires": {
|
||||
"unist-util-visit": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"unist-util-visit": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz",
|
||||
"integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==",
|
||||
"requires": {
|
||||
"unist-util-visit-parents": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"vfile": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/vfile/-/vfile-1.4.0.tgz",
|
||||
"integrity": "sha1-wP1vpIT43r23cfaMMe112I2pf+c="
|
||||
},
|
||||
"vfile-location": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.6.tgz",
|
||||
"integrity": "sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"unist-util-find-after": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-3.0.0.tgz",
|
||||
"integrity": "sha512-ojlBqfsBftYXExNu3+hHLfJQ/X1jYY/9vdm4yZWjIbf0VuWF6CRufci1ZyoD/wV2TYMKxXUoNuoqwy+CkgzAiQ==",
|
||||
"requires": {
|
||||
"unist-util-is": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"unist-util-find-all-after": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-find-all-after/-/unist-util-find-all-after-3.0.1.tgz",
|
||||
"integrity": "sha512-0GICgc++sRJesLwEYDjFVJPJttBpVQaTNgc6Jw0Jhzvfs+jtKePEMu+uD+PqkRUrAvGQqwhpDwLGWo1PK8PDEw==",
|
||||
"requires": {
|
||||
"unist-util-is": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"unist-util-find-all-between": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-find-all-between/-/unist-util-find-all-between-2.1.0.tgz",
|
||||
"integrity": "sha512-OCCUtDD8UHKeODw3TPXyFDxPCbpgBzbGTTaDpR68nvxkwiVcawBqMVrokfBMvUi7ij2F5q7S4s4Jq5dvkcBt+w==",
|
||||
"requires": {
|
||||
"unist-util-find": "^1.0.1",
|
||||
"unist-util-is": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"unist-util-generated": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.5.tgz",
|
||||
"integrity": "sha512-1TC+NxQa4N9pNdayCYA1EGUOCAO0Le3fVp7Jzns6lnua/mYgwHo0tz5WUAfrdpNch1RZLHc61VZ1SDgrtNXLSw=="
|
||||
},
|
||||
"unist-util-is": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz",
|
||||
"integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ=="
|
||||
},
|
||||
"unist-util-modify-children": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-modify-children/-/unist-util-modify-children-2.0.0.tgz",
|
||||
"integrity": "sha512-HGrj7JQo9DwZt8XFsX8UD4gGqOsIlCih9opG6Y+N11XqkBGKzHo8cvDi+MfQQgiZ7zXRUiQREYHhjOBHERTMdg==",
|
||||
"requires": {
|
||||
"array-iterate": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"unist-util-position": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.1.0.tgz",
|
||||
"integrity": "sha512-w+PkwCbYSFw8vpgWD0v7zRCl1FpY3fjDSQ3/N/wNd9Ffa4gPi8+4keqt99N3XW6F99t/mUzp2xAhNmfKWp95QA=="
|
||||
},
|
||||
"unist-util-remove": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-remove/-/unist-util-remove-2.0.0.tgz",
|
||||
"integrity": "sha512-HwwWyNHKkeg/eXRnE11IpzY8JT55JNM1YCwwU9YNCnfzk6s8GhPXrVBBZWiwLeATJbI7euvoGSzcy9M29UeW3g==",
|
||||
"requires": {
|
||||
"unist-util-is": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"unist-util-select": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-select/-/unist-util-select-3.0.1.tgz",
|
||||
"integrity": "sha512-VQpTuqZVJlRbosQdnLdTPIIqwZeU70YZ5aMBOqtFNGeeCdYn6ORZt/9RiaVlbl06ocuf58SVMoFa7a13CSGPMA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"css-selector-parser": "^1.0.0",
|
||||
"not": "^0.1.0",
|
||||
"nth-check": "^1.0.0",
|
||||
"unist-util-is": "^4.0.0",
|
||||
"zwitch": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"unist-util-stringify-position": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz",
|
||||
"integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"unist-util-visit": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz",
|
||||
"integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"unist-util-is": "^4.0.0",
|
||||
"unist-util-visit-parents": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"unist-util-visit-parents": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz",
|
||||
"integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"unist-util-is": "^4.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"unist-util-visit-children": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-visit-children/-/unist-util-visit-children-1.1.4.tgz",
|
||||
"integrity": "sha512-sA/nXwYRCQVRwZU2/tQWUqJ9JSFM1X3x7JIOsIgSzrFHcfVt6NkzDtKzyxg2cZWkCwGF9CO8x4QNZRJRMK8FeQ=="
|
||||
},
|
||||
"unist-util-visit-parents": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz",
|
||||
"integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==",
|
||||
"requires": {
|
||||
"unist-util-is": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"unist-util-is": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz",
|
||||
"integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"vfile": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.0.tgz",
|
||||
"integrity": "sha512-a/alcwCvtuc8OX92rqqo7PflxiCgXRFjdyoGVuYV+qbgCb0GgZJRvIgCD4+U/Kl1yhaRsaTwksF88xbPyGsgpw==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"is-buffer": "^2.0.0",
|
||||
"replace-ext": "1.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0",
|
||||
"vfile-message": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"vfile-message": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-2.0.4.tgz",
|
||||
"integrity": "sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"x-is-string": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz",
|
||||
"integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI="
|
||||
},
|
||||
"xtend": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
|
||||
},
|
||||
"zwitch": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/zwitch/-/zwitch-1.0.5.tgz",
|
||||
"integrity": "sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw=="
|
||||
}
|
||||
}
|
||||
}
|
39
tools/challenge-parser/parser/package.json
Normal file
39
tools/challenge-parser/parser/package.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "challenge-parser",
|
||||
"version": "0.0.1",
|
||||
"description": "converts mdx files to challenge objects",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"unist-util-select": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"hast-util-to-html": "^7.1.1",
|
||||
"js-yaml": "^3.12.0",
|
||||
"lodash": "^4.17.19",
|
||||
"mdast-builder": "^1.1.1",
|
||||
"mdast-util-gfm": "^0.1.0",
|
||||
"mdast-util-to-hast": "^9.1.1",
|
||||
"micromark-extension-gfm-strikethrough": "^0.6.1",
|
||||
"micromark-extension-gfm-table": "^0.4.1",
|
||||
"remark": "^13.0.0",
|
||||
"remark-directive": "^1.0.1",
|
||||
"remark-frontmatter": "^3.0.0",
|
||||
"remark-html": "^12.0.0",
|
||||
"remark-parse": "^9.0.0",
|
||||
"to-vfile": "^5.0.1",
|
||||
"unified": "^7.0.0",
|
||||
"unist-util-find": "^1.0.1",
|
||||
"unist-util-find-after": "^3.0.0",
|
||||
"unist-util-find-all-after": "^3.0.1",
|
||||
"unist-util-find-all-between": "^2.0.0",
|
||||
"unist-util-is": "^4.0.2",
|
||||
"unist-util-modify-children": "^2.0.0",
|
||||
"unist-util-position": "^3.1.0",
|
||||
"unist-util-remove": "^2.0.0",
|
||||
"unist-util-visit": "^2.0.3",
|
||||
"unist-util-visit-children": "^1.1.4"
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`process-frontmatter plugin should have an output to match the snapshot 1`] = `
|
||||
Object {
|
||||
"challengeType": 0,
|
||||
"forumTopicId": 18276,
|
||||
"id": "bd7123c8c441eddfaeb5bdef",
|
||||
"title": "Say Hello to HTML Elements",
|
||||
"videoUrl": "https://scrimba.com/p/pVMPUv/cE8Gpt2",
|
||||
}
|
||||
`;
|
@ -0,0 +1,43 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`add-seed plugin should have an output to match the snapshot 1`] = `
|
||||
Object {
|
||||
"files": Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: green;
|
||||
}",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';",
|
||||
"editableRegionBoundaries": Array [],
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
@ -0,0 +1,43 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`add solution plugin should have an output to match the snapshot 1`] = `
|
||||
Object {
|
||||
"solutions": Array [
|
||||
Object {
|
||||
"indexcss": Object {
|
||||
"contents": "body {
|
||||
background: white;
|
||||
}",
|
||||
"ext": "css",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexcss",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexhtml": Object {
|
||||
"contents": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
"ext": "html",
|
||||
"head": "",
|
||||
"id": "html-key",
|
||||
"key": "indexhtml",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
"indexjs": Object {
|
||||
"contents": "var x = 'y';
|
||||
\`\`",
|
||||
"ext": "js",
|
||||
"head": "",
|
||||
"id": "",
|
||||
"key": "indexjs",
|
||||
"name": "index",
|
||||
"tail": "",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
@ -0,0 +1,23 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`add-tests plugin should have an output to match the snapshot 1`] = `
|
||||
Object {
|
||||
"tests": Array [
|
||||
Object {
|
||||
"testString": "// test code",
|
||||
"text": "<p>First hint</p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "// more test code",
|
||||
"text": "<p>Second hint with <code>code</code></p>",
|
||||
},
|
||||
Object {
|
||||
"testString": "// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}",
|
||||
"text": "<p>Third <em>hint</em> with <code>code</code> and <code>inline code</code></p>",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
@ -0,0 +1,16 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`add-text should have an output to match the snapshot 1`] = `
|
||||
Object {
|
||||
"description": "<section id=\\"description\\">
|
||||
<p>Paragraph 1</p>
|
||||
<pre><code class=\\"language-html\\">code example
|
||||
</code></pre>
|
||||
</section>",
|
||||
"instructions": "<section id=\\"instructions\\">
|
||||
<p>Paragraph 0</p>
|
||||
<pre><code class=\\"language-html\\">code example 0
|
||||
</code></pre>
|
||||
</section>",
|
||||
}
|
||||
`;
|
@ -0,0 +1,18 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`add-video-question plugin should match the video snapshot 1`] = `
|
||||
Object {
|
||||
"question": Object {
|
||||
"answers": Array [
|
||||
"<p>Some inline <code>code</code></p>",
|
||||
"<p>Some <em>italics</em></p>
|
||||
<p>A second answer paragraph.</p>",
|
||||
"<p><code> code in </code> code tags</p>",
|
||||
],
|
||||
"solution": 3,
|
||||
"text": "<p>Question line 1</p>
|
||||
<pre><code class=\\"language-js\\"> var x = 'y';
|
||||
</code></pre>",
|
||||
},
|
||||
}
|
||||
`;
|
@ -0,0 +1,558 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`replace-imports should have an output to match the snapshot 1`] = `
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 18,
|
||||
"line": 3,
|
||||
"offset": 68,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 3,
|
||||
"line": 3,
|
||||
"offset": 53,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "--description--",
|
||||
},
|
||||
],
|
||||
"depth": 1,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 18,
|
||||
"line": 3,
|
||||
"offset": 68,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 3,
|
||||
"offset": 51,
|
||||
},
|
||||
},
|
||||
"type": "heading",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 12,
|
||||
"line": 5,
|
||||
"offset": 81,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 5,
|
||||
"offset": 70,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "Paragraph 1",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 12,
|
||||
"line": 5,
|
||||
"offset": 81,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 5,
|
||||
"offset": 70,
|
||||
},
|
||||
},
|
||||
"type": "paragraph",
|
||||
},
|
||||
Object {
|
||||
"lang": "html",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 9,
|
||||
"offset": 107,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 7,
|
||||
"offset": 83,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "code example",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 19,
|
||||
"line": 11,
|
||||
"offset": 127,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 3,
|
||||
"line": 11,
|
||||
"offset": 111,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "--instructions--",
|
||||
},
|
||||
],
|
||||
"depth": 1,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 19,
|
||||
"line": 11,
|
||||
"offset": 127,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 11,
|
||||
"offset": 109,
|
||||
},
|
||||
},
|
||||
"type": "heading",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 12,
|
||||
"line": 13,
|
||||
"offset": 140,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 13,
|
||||
"offset": 129,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "Paragraph 0",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 12,
|
||||
"line": 13,
|
||||
"offset": 140,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 13,
|
||||
"offset": 129,
|
||||
},
|
||||
},
|
||||
"type": "paragraph",
|
||||
},
|
||||
Object {
|
||||
"lang": "html",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 17,
|
||||
"offset": 168,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 15,
|
||||
"offset": 142,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "code example 0",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 12,
|
||||
"line": 19,
|
||||
"offset": 181,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 3,
|
||||
"line": 19,
|
||||
"offset": 172,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "--hints--",
|
||||
},
|
||||
],
|
||||
"depth": 1,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 12,
|
||||
"line": 19,
|
||||
"offset": 181,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 19,
|
||||
"offset": 170,
|
||||
},
|
||||
},
|
||||
"type": "heading",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 11,
|
||||
"line": 21,
|
||||
"offset": 193,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 21,
|
||||
"offset": 183,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "First hint",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 11,
|
||||
"line": 21,
|
||||
"offset": 193,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 21,
|
||||
"offset": 183,
|
||||
},
|
||||
},
|
||||
"type": "paragraph",
|
||||
},
|
||||
Object {
|
||||
"lang": "js",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 25,
|
||||
"offset": 217,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 23,
|
||||
"offset": 195,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "// test code",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 18,
|
||||
"line": 27,
|
||||
"offset": 236,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 27,
|
||||
"offset": 219,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "Second hint with ",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 24,
|
||||
"line": 27,
|
||||
"offset": 242,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 18,
|
||||
"line": 27,
|
||||
"offset": 236,
|
||||
},
|
||||
},
|
||||
"type": "html",
|
||||
"value": "<code>",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 28,
|
||||
"line": 27,
|
||||
"offset": 246,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 24,
|
||||
"line": 27,
|
||||
"offset": 242,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "code",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 35,
|
||||
"line": 27,
|
||||
"offset": 253,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 28,
|
||||
"line": 27,
|
||||
"offset": 246,
|
||||
},
|
||||
},
|
||||
"type": "html",
|
||||
"value": "</code>",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 35,
|
||||
"line": 27,
|
||||
"offset": 253,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 27,
|
||||
"offset": 219,
|
||||
},
|
||||
},
|
||||
"type": "paragraph",
|
||||
},
|
||||
Object {
|
||||
"lang": "js",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 31,
|
||||
"offset": 282,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 29,
|
||||
"offset": 255,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "// more test code",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 11,
|
||||
"line": 34,
|
||||
"offset": 295,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 3,
|
||||
"line": 34,
|
||||
"offset": 287,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "--seed--",
|
||||
},
|
||||
],
|
||||
"depth": 1,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 11,
|
||||
"line": 34,
|
||||
"offset": 295,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 34,
|
||||
"offset": 285,
|
||||
},
|
||||
},
|
||||
"type": "heading",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 21,
|
||||
"line": 36,
|
||||
"offset": 317,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 4,
|
||||
"line": 36,
|
||||
"offset": 300,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "--seed-contents--",
|
||||
},
|
||||
],
|
||||
"depth": 2,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 21,
|
||||
"line": 36,
|
||||
"offset": 317,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 36,
|
||||
"offset": 297,
|
||||
},
|
||||
},
|
||||
"type": "heading",
|
||||
},
|
||||
Object {
|
||||
"lang": "html",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 43,
|
||||
"offset": 364,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 38,
|
||||
"offset": 319,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>",
|
||||
},
|
||||
Object {
|
||||
"lang": "css",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 49,
|
||||
"offset": 406,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 45,
|
||||
"offset": 366,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "body {
|
||||
background: green;
|
||||
}",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"alt": "custom-name",
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 17,
|
||||
"line": 51,
|
||||
"offset": 424,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 51,
|
||||
"offset": 408,
|
||||
},
|
||||
},
|
||||
"title": null,
|
||||
"type": "image",
|
||||
"url": "",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 17,
|
||||
"line": 51,
|
||||
"offset": 424,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 51,
|
||||
"offset": 408,
|
||||
},
|
||||
},
|
||||
"type": "paragraph",
|
||||
},
|
||||
Object {
|
||||
"lang": "js",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 55,
|
||||
"offset": 448,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 53,
|
||||
"offset": 426,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "var x = 'y';",
|
||||
},
|
||||
Object {
|
||||
"lang": "js",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 6,
|
||||
"offset": 125,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 1,
|
||||
"offset": 0,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "for (let index = 0; index < array.length; index++) {
|
||||
const element = array[index];
|
||||
// imported from script.md
|
||||
}",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 1,
|
||||
"line": 58,
|
||||
"offset": 476,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 1,
|
||||
"offset": 0,
|
||||
},
|
||||
},
|
||||
"type": "root",
|
||||
}
|
||||
`;
|
18
tools/challenge-parser/parser/plugins/add-frontmatter.js
Normal file
18
tools/challenge-parser/parser/plugins/add-frontmatter.js
Normal file
@ -0,0 +1,18 @@
|
||||
const visit = require('unist-util-visit');
|
||||
const YAML = require('js-yaml');
|
||||
|
||||
function plugin() {
|
||||
return transformer;
|
||||
|
||||
function transformer(tree, file) {
|
||||
visit(tree, 'yaml', visitor);
|
||||
|
||||
function visitor(node) {
|
||||
const frontmatter = YAML.load(node.value);
|
||||
|
||||
file.data = { ...file.data, ...frontmatter };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = plugin;
|
@ -0,0 +1,72 @@
|
||||
/* global describe it expect beforeEach */
|
||||
|
||||
const { isObject } = require('lodash');
|
||||
|
||||
const mockAST = require('../__fixtures__/ast-yaml-challenge.json');
|
||||
const processFrontmatter = require('./add-frontmatter');
|
||||
|
||||
describe('process-frontmatter plugin', () => {
|
||||
const plugin = processFrontmatter();
|
||||
let file = { data: {} };
|
||||
beforeEach(() => {
|
||||
file = { data: {} };
|
||||
});
|
||||
|
||||
it('should return a plugin which is a function', () => {
|
||||
expect(typeof plugin).toEqual('function');
|
||||
});
|
||||
|
||||
it('should maintain an object for the `file.data` property', () => {
|
||||
plugin(mockAST, file);
|
||||
expect(isObject(file.data)).toBe(true);
|
||||
});
|
||||
|
||||
// And no others. The AST includes some yaml code, and this also
|
||||
// checks that none of those keys get parsed
|
||||
it('should add all keys from frontmatter to the `file.data` property', () => {
|
||||
const expectedKeys = [
|
||||
'id',
|
||||
'title',
|
||||
'challengeType',
|
||||
'videoUrl',
|
||||
'forumTopicId'
|
||||
];
|
||||
plugin(mockAST, file);
|
||||
const actualKeys = Object.keys(file.data);
|
||||
expect(actualKeys).toEqual(expectedKeys);
|
||||
});
|
||||
|
||||
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');
|
||||
expect(typeof title).toEqual('string');
|
||||
expect(typeof challengeType).toEqual('number');
|
||||
expect(typeof videoUrl).toEqual('string');
|
||||
expect(typeof forumTopicId).toEqual('number');
|
||||
});
|
||||
|
||||
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);
|
||||
keys.forEach(key => expect(whitespaceRE.test(key)).toBe(false));
|
||||
const values = keys.map(key => file.data[key]);
|
||||
values
|
||||
.filter(value => typeof value === 'string')
|
||||
.forEach(value => expect(whitespaceRE.test(value)).toBe(false));
|
||||
});
|
||||
|
||||
it('should not mutate url strings', () => {
|
||||
const expectedUrl = 'https://scrimba.com/p/pVMPUv/cE8Gpt2';
|
||||
plugin(mockAST, file);
|
||||
expect(file.data.videoUrl).toEqual(expectedUrl);
|
||||
});
|
||||
|
||||
it('should have an output to match the snapshot', () => {
|
||||
plugin(mockAST, file);
|
||||
expect(file.data).toMatchSnapshot();
|
||||
});
|
||||
});
|
35
tools/challenge-parser/parser/plugins/add-ids.js
Normal file
35
tools/challenge-parser/parser/plugins/add-ids.js
Normal file
@ -0,0 +1,35 @@
|
||||
const visitChildren = require('unist-util-visit-children');
|
||||
|
||||
function hasId(node, index, parent) {
|
||||
// image references should always be inside paragraphs.
|
||||
if (node.type !== 'paragraph') return;
|
||||
const idHolder = node.children[0];
|
||||
if (idHolder.type === 'imageReference') {
|
||||
if (node.children.length > 1) {
|
||||
console.log('oooops, too many links together!');
|
||||
// TODO: optional chaining
|
||||
} else if (
|
||||
parent.children[index + 1] &&
|
||||
parent.children[index + 1].type === 'code'
|
||||
) {
|
||||
console.log('found adjacent code block for id ' + idHolder.identifier);
|
||||
} else {
|
||||
console.log(
|
||||
'ooops! the id ' + idHolder.identifier + ' is not next to a code block'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function plugin() {
|
||||
// we don't want to recurse into the tree, hence visitChildren
|
||||
|
||||
const visit = visitChildren(hasId);
|
||||
return transformer;
|
||||
|
||||
function transformer(tree) {
|
||||
visit(tree);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = plugin;
|
107
tools/challenge-parser/parser/plugins/add-seed.js
Normal file
107
tools/challenge-parser/parser/plugins/add-seed.js
Normal file
@ -0,0 +1,107 @@
|
||||
const getAllBetween = require('./utils/between-headings');
|
||||
// const visit = require('unist-util-visit');
|
||||
const visitChildren = require('unist-util-visit-children');
|
||||
const { root } = require('mdast-builder');
|
||||
const { getFileVisitor } = require('./utils/get-file-visitor');
|
||||
const { isEmpty } = require('lodash');
|
||||
|
||||
const editableRegionMarker = '--fcc-editable-region--';
|
||||
|
||||
function findRegionMarkers(file) {
|
||||
const lines = file.contents.split('\n');
|
||||
const editableLines = lines
|
||||
.map((line, id) => (line.trim() === editableRegionMarker ? id : -1))
|
||||
.filter(id => id >= 0);
|
||||
|
||||
if (editableLines.length > 2) {
|
||||
throw Error('Editable region has too many markers: ' + editableLines);
|
||||
}
|
||||
|
||||
if (editableLines.length === 0) {
|
||||
return null;
|
||||
} else if (editableLines.length === 1) {
|
||||
throw Error(`Editable region not closed`);
|
||||
} else {
|
||||
return editableLines;
|
||||
}
|
||||
}
|
||||
|
||||
function removeLines(contents, toRemove) {
|
||||
const lines = contents.split('\n');
|
||||
return lines.filter((_, id) => !toRemove.includes(id)).join('\n');
|
||||
}
|
||||
|
||||
// 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--`));
|
||||
// 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 seeds = {};
|
||||
|
||||
// While before and after code are optional, the contents are not
|
||||
if (isEmpty(contentsTree.children))
|
||||
throw Error('## --seed-contents-- must appear in # --seed-- sections');
|
||||
|
||||
const visitForContents = visitChildren(
|
||||
getFileVisitor(seeds, 'contents', validateEditableMarkers)
|
||||
);
|
||||
const visitForHead = visitChildren(getFileVisitor(seeds, 'head'));
|
||||
const visitForTail = visitChildren(getFileVisitor(seeds, 'tail'));
|
||||
visitForContents(contentsTree);
|
||||
visitForHead(headTree);
|
||||
visitForTail(tailTree);
|
||||
file.data = {
|
||||
...file.data,
|
||||
files: seeds
|
||||
};
|
||||
|
||||
// process region markers - remove them from content and add them to data
|
||||
Object.keys(seeds).forEach(key => {
|
||||
const fileData = seeds[key];
|
||||
const editRegionMarkers = findRegionMarkers(fileData);
|
||||
if (editRegionMarkers) {
|
||||
fileData.contents = removeLines(fileData.contents, editRegionMarkers);
|
||||
|
||||
if (editRegionMarkers[1] <= editRegionMarkers[0]) {
|
||||
throw Error('Editable region must be non zero');
|
||||
}
|
||||
fileData.editableRegionBoundaries = editRegionMarkers;
|
||||
} else {
|
||||
fileData.editableRegionBoundaries = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return transformer;
|
||||
}
|
||||
|
||||
function validateEditableMarkers({ value, position }) {
|
||||
const twoMarkersRE = RegExp(
|
||||
editableRegionMarker + '.*' + editableRegionMarker
|
||||
);
|
||||
const formattedMarkerRE = /--fcc - editable - region--/;
|
||||
const lines = value.split('\n');
|
||||
const baseLineNumber = position.start.line + 1;
|
||||
lines.forEach((line, index) => {
|
||||
if (line.match(twoMarkersRE)) {
|
||||
throw Error(
|
||||
`Line ${baseLineNumber +
|
||||
index} has two markers. Each line should only have one.`
|
||||
);
|
||||
}
|
||||
if (line.match(formattedMarkerRE)) {
|
||||
throw Error(
|
||||
`Line ${baseLineNumber +
|
||||
index} has a malformed marker. It should be --fcc-editable-region--`
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = addSeeds;
|
||||
module.exports.editableRegionMarker = editableRegionMarker;
|
287
tools/challenge-parser/parser/plugins/add-seed.test.js
Normal file
287
tools/challenge-parser/parser/plugins/add-seed.test.js
Normal file
@ -0,0 +1,287 @@
|
||||
/* global describe it expect beforeEach */
|
||||
const isArray = require('lodash/isArray');
|
||||
|
||||
const simpleAST = require('../__fixtures__/ast-simple.json');
|
||||
const withEditableAST = require('../__fixtures__/ast-with-markers.json');
|
||||
const withSeedKeysAST = require('../__fixtures__/ast-seed-keys.json');
|
||||
const withExtraLinesAST = require('../__fixtures__/ast-with-extra-lines.json');
|
||||
const orphanKeyAST = require('../__fixtures__/ast-orphan-key.json');
|
||||
const adjacentKeysAST = require('../__fixtures__/ast-adjacent-keys.json');
|
||||
const withBeforeAfterAST = require('../__fixtures__/ast-before-after.json');
|
||||
const emptyBeforeAST = require('../__fixtures__/ast-empty-before.json');
|
||||
const emptyAfterAST = require('../__fixtures__/ast-empty-after.json');
|
||||
const emptyCSSAST = require('../__fixtures__/ast-empty-css.json');
|
||||
const emptyHTMLAST = require('../__fixtures__/ast-empty-html.json');
|
||||
const doubleMarkerAST = require('../__fixtures__/ast-double-marker.json');
|
||||
const jsxSeedAST = require('../__fixtures__/ast-jsx-seed.json');
|
||||
const cCodeAST = require('../__fixtures__/ast-c-code.json');
|
||||
const explodedMarkerAST = require('../__fixtures__/ast-exploded-marker.json');
|
||||
const emptyContentAST = require('../__fixtures__/ast-empty-contents.json');
|
||||
|
||||
const addSeed = require('./add-seed');
|
||||
const { isObject } = require('lodash');
|
||||
|
||||
describe('add-seed plugin', () => {
|
||||
const plugin = addSeed();
|
||||
let file = { data: {} };
|
||||
|
||||
beforeEach(() => {
|
||||
file = { data: {} };
|
||||
});
|
||||
|
||||
it('returns a function', () => {
|
||||
expect(typeof plugin).toEqual('function');
|
||||
});
|
||||
|
||||
it('adds a `files` property to `file.data`', () => {
|
||||
plugin(simpleAST, file);
|
||||
expect('files' in file.data).toBe(true);
|
||||
});
|
||||
|
||||
it('ensures that the `files` property is an object', () => {
|
||||
plugin(simpleAST, file);
|
||||
expect(isObject(file.data.files)).toBe(true);
|
||||
});
|
||||
|
||||
it('adds test objects to the files array following a schema', () => {
|
||||
expect.assertions(17);
|
||||
plugin(simpleAST, file);
|
||||
const {
|
||||
data: { files }
|
||||
} = file;
|
||||
const testObject = files.indexjs;
|
||||
expect(Object.keys(testObject).length).toEqual(8);
|
||||
expect(testObject).toHaveProperty('key');
|
||||
expect(typeof testObject['key']).toBe('string');
|
||||
expect(testObject).toHaveProperty('ext');
|
||||
expect(typeof testObject['ext']).toBe('string');
|
||||
expect(testObject).toHaveProperty('name');
|
||||
expect(typeof testObject['name']).toBe('string');
|
||||
expect(testObject).toHaveProperty('contents');
|
||||
expect(typeof testObject['contents']).toBe('string');
|
||||
expect(testObject).toHaveProperty('head');
|
||||
expect(typeof testObject['head']).toBe('string');
|
||||
expect(testObject).toHaveProperty('tail');
|
||||
expect(typeof testObject['tail']).toBe('string');
|
||||
expect(testObject).toHaveProperty('id');
|
||||
expect(typeof testObject['id']).toBe('string');
|
||||
expect(testObject).toHaveProperty('editableRegionBoundaries');
|
||||
expect(isArray(testObject['editableRegionBoundaries'])).toBe(true);
|
||||
});
|
||||
|
||||
it('parses seeds without ids', () => {
|
||||
expect.assertions(6);
|
||||
plugin(simpleAST, file);
|
||||
const {
|
||||
data: { files }
|
||||
} = file;
|
||||
const { indexjs, indexhtml, indexcss } = files;
|
||||
|
||||
expect(indexjs.contents).toBe(`var x = 'y';`);
|
||||
expect(indexjs.key).toBe(`indexjs`);
|
||||
expect(indexhtml.contents).toBe(`<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>`);
|
||||
expect(indexhtml.key).toBe(`indexhtml`);
|
||||
expect(indexcss.contents).toBe(`body {
|
||||
background: green;
|
||||
}`);
|
||||
expect(indexcss.key).toBe(`indexcss`);
|
||||
});
|
||||
|
||||
it('removes region markers from contents', () => {
|
||||
expect.assertions(2);
|
||||
plugin(withEditableAST, file);
|
||||
const {
|
||||
data: { files }
|
||||
} = file;
|
||||
const { indexcss } = files;
|
||||
|
||||
expect(indexcss.contents).not.toMatch('--fcc-editable-region--');
|
||||
expect(indexcss.editableRegionBoundaries).toEqual([1, 4]);
|
||||
});
|
||||
|
||||
// TODO: can we reuse 'name'? It's always 'index', I think, which suggests
|
||||
// it could be reused as an id. Revisit this once the parser is live.
|
||||
it('parses seeds with adjacent ids, adding the id to data', () => {
|
||||
expect.assertions(3);
|
||||
plugin(withSeedKeysAST, file);
|
||||
const {
|
||||
data: { files }
|
||||
} = file;
|
||||
const { indexhtml, indexcss, indexjs } = files;
|
||||
|
||||
expect(indexhtml.id).toBe('');
|
||||
expect(indexcss.id).toBe('key-for-css');
|
||||
expect(indexjs.id).toBe('key-for-js');
|
||||
});
|
||||
|
||||
it('throws if an id is anywhere except directly before a code node', () => {
|
||||
expect.assertions(2);
|
||||
expect(() => plugin(adjacentKeysAST, file)).toThrow(
|
||||
'::id{#id}s must come before code blocks'
|
||||
);
|
||||
expect(() => plugin(orphanKeyAST, file)).toThrow(
|
||||
'::id{#id}s must come before code blocks'
|
||||
);
|
||||
});
|
||||
|
||||
it('ignores empty lines between ::id{#id}s and code blocks', () => {
|
||||
expect.assertions(1);
|
||||
plugin(withSeedKeysAST, file);
|
||||
const fileTwo = { data: {} };
|
||||
plugin(withExtraLinesAST, fileTwo);
|
||||
expect(file).toEqual(fileTwo);
|
||||
});
|
||||
|
||||
it('gets the before-user-code for each language', () => {
|
||||
expect.assertions(3);
|
||||
plugin(withBeforeAfterAST, file);
|
||||
const {
|
||||
data: { files }
|
||||
} = file;
|
||||
const { indexjs, indexhtml, indexcss } = files;
|
||||
|
||||
expect(indexjs.head).toBe('');
|
||||
expect(indexhtml.head).toBe(`<!-- comment -->`);
|
||||
expect(indexcss.head).toBe(`body {
|
||||
etc: ''
|
||||
}`);
|
||||
});
|
||||
|
||||
it('gets the after-user-code for each language', () => {
|
||||
expect.assertions(3);
|
||||
plugin(withBeforeAfterAST, file);
|
||||
const {
|
||||
data: { files }
|
||||
} = file;
|
||||
const { indexjs, indexhtml, indexcss } = files;
|
||||
|
||||
expect(indexjs.tail).toBe(`function teardown(params) {
|
||||
// after
|
||||
}`);
|
||||
expect(indexhtml.tail).toBe('');
|
||||
expect(indexcss.tail).toBe(`body {
|
||||
background: blue;
|
||||
}`);
|
||||
});
|
||||
|
||||
it('throws an error if there is any code of an unsupported language', () => {
|
||||
expect.assertions(1);
|
||||
expect(() => plugin(cCodeAST, file)).toThrow(
|
||||
"On line 30 'c' is not a supported language.\n" +
|
||||
' Please use one of js, css, html, jsx or py'
|
||||
);
|
||||
});
|
||||
|
||||
it('throws if there is before/after code with empty blocks', () => {
|
||||
expect.assertions(2);
|
||||
expect(() => plugin(emptyHTMLAST, file)).toThrow(
|
||||
'Empty code block in --before-user-code-- section'
|
||||
);
|
||||
expect(() => plugin(emptyCSSAST, file)).toThrow(
|
||||
'Empty code block in --after-user-code-- section'
|
||||
);
|
||||
});
|
||||
|
||||
it('quietly ignores empty before sections', () => {
|
||||
expect.assertions(6);
|
||||
plugin(emptyBeforeAST, file);
|
||||
const {
|
||||
data: { files }
|
||||
} = file;
|
||||
const { indexjs, indexhtml, indexcss } = files;
|
||||
|
||||
expect(indexjs.head).toBe('');
|
||||
expect(indexjs.tail).toBe('function teardown(params) {\n // after\n}');
|
||||
expect(indexhtml.head).toBe('');
|
||||
expect(indexhtml.tail).toBe('');
|
||||
expect(indexcss.head).toBe('');
|
||||
expect(indexcss.tail).toBe('body {\n background: blue;\n}');
|
||||
});
|
||||
|
||||
it('quietly ignores empty after sections', () => {
|
||||
expect.assertions(6);
|
||||
plugin(emptyAfterAST, file);
|
||||
const {
|
||||
data: { files }
|
||||
} = file;
|
||||
const { indexjs, indexhtml, indexcss } = files;
|
||||
|
||||
expect(indexjs.head).toBe('');
|
||||
expect(indexjs.tail).toBe('');
|
||||
expect(indexhtml.head).toBe('<!-- comment -->');
|
||||
expect(indexhtml.tail).toBe('');
|
||||
expect(indexcss.head).toBe("body {\n etc: ''\n}");
|
||||
expect(indexcss.tail).toBe('');
|
||||
});
|
||||
|
||||
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--`
|
||||
);
|
||||
});
|
||||
|
||||
it('handles jsx', () => {
|
||||
expect.assertions(4);
|
||||
plugin(jsxSeedAST, file);
|
||||
const {
|
||||
data: { files }
|
||||
} = file;
|
||||
const { indexjsx } = files;
|
||||
|
||||
expect(indexjsx.head).toBe(`function setup() {}`);
|
||||
expect(indexjsx.tail).toBe(`function teardown(params) {
|
||||
// after
|
||||
}`);
|
||||
expect(indexjsx.contents).toBe(`var x = 'y';
|
||||
|
||||
/* comment */
|
||||
const Button = () => {
|
||||
return <button> {/* another comment! */} text </button>;
|
||||
};`);
|
||||
expect(indexjsx.key).toBe(`indexjsx`);
|
||||
});
|
||||
|
||||
it('combines all the code of a specific language into a single file', () => {
|
||||
/* Revisit this once we've decided what to do about multifile imports. I
|
||||
think the best approach is likely to be use the following format for .files
|
||||
|
||||
{ css: [css files],
|
||||
html: [html files],
|
||||
...
|
||||
}
|
||||
|
||||
or
|
||||
|
||||
{ css: {css files},
|
||||
html: {html files},
|
||||
...
|
||||
}
|
||||
|
||||
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(
|
||||
`## --seed-contents-- must appear in # --seed-- sections`
|
||||
);
|
||||
});
|
||||
|
||||
it('should have an output to match the snapshot', () => {
|
||||
plugin(simpleAST, file);
|
||||
expect(file.data).toMatchSnapshot();
|
||||
});
|
||||
});
|
43
tools/challenge-parser/parser/plugins/add-solution.js
Normal file
43
tools/challenge-parser/parser/plugins/add-solution.js
Normal file
@ -0,0 +1,43 @@
|
||||
const visitChildren = require('unist-util-visit-children');
|
||||
const { root } = require('mdast-builder');
|
||||
|
||||
const { getFileVisitor } = require('./utils/get-file-visitor');
|
||||
const { splitOnThematicBreak } = require('./utils/split-on-thematic-break');
|
||||
const getAllBetween = require('./utils/between-headings');
|
||||
const { editableRegionMarker } = require('./add-seed');
|
||||
|
||||
function validateMarkers({ value }) {
|
||||
const lines = value.split('\n');
|
||||
if (lines.some(line => line.match(RegExp(editableRegionMarker))))
|
||||
throw Error(
|
||||
'--fcc-editable-region-- should only appear in the --seed-contents--\n' +
|
||||
'section, not in --solutions--'
|
||||
);
|
||||
}
|
||||
|
||||
function createPlugin() {
|
||||
return function transformer(tree, file) {
|
||||
const solutionArrays = splitOnThematicBreak(
|
||||
getAllBetween(tree, `--solutions--`)
|
||||
);
|
||||
const solutions = [];
|
||||
|
||||
solutionArrays.forEach(nodes => {
|
||||
const solution = {};
|
||||
const solutionTree = root(nodes);
|
||||
const visitForContents = visitChildren(
|
||||
getFileVisitor(solution, 'contents', validateMarkers)
|
||||
);
|
||||
|
||||
visitForContents(solutionTree);
|
||||
solutions.push(solution);
|
||||
});
|
||||
|
||||
file.data = {
|
||||
...file.data,
|
||||
solutions: solutions
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = createPlugin;
|
92
tools/challenge-parser/parser/plugins/add-solution.test.js
Normal file
92
tools/challenge-parser/parser/plugins/add-solution.test.js
Normal file
@ -0,0 +1,92 @@
|
||||
/* global describe it expect beforeEach */
|
||||
const mockAST = require('../__fixtures__/ast-simple.json');
|
||||
const editableSolutionAST = require('../__fixtures__/ast-erm-in-solution.json');
|
||||
const multiSolnsAST = require('../__fixtures__/ast-multiple-solutions.json');
|
||||
|
||||
const addSolution = require('./add-solution');
|
||||
const { isObject } = require('lodash');
|
||||
|
||||
describe('add solution plugin', () => {
|
||||
const plugin = addSolution();
|
||||
let file = { data: {} };
|
||||
|
||||
beforeEach(() => {
|
||||
file = { data: {} };
|
||||
});
|
||||
|
||||
it('returns a function', () => {
|
||||
expect(typeof plugin).toEqual('function');
|
||||
});
|
||||
|
||||
it('adds a `solutions` property to `file.data`', () => {
|
||||
plugin(mockAST, file);
|
||||
expect('solutions' in file.data).toBe(true);
|
||||
});
|
||||
|
||||
it('ensures that the `solutions` property is an array', () => {
|
||||
plugin(mockAST, file);
|
||||
expect(Array.isArray(file.data.solutions)).toBe(true);
|
||||
});
|
||||
|
||||
it('each entry in the `solutions` array is an object', () => {
|
||||
plugin(mockAST, file);
|
||||
|
||||
expect(file.data.solutions.every(el => isObject(el))).toBe(true);
|
||||
});
|
||||
|
||||
it('adds solution objects to the files array following a schema', () => {
|
||||
expect.assertions(15);
|
||||
plugin(mockAST, file);
|
||||
const {
|
||||
data: { solutions }
|
||||
} = file;
|
||||
const testObject = solutions[0].indexjs;
|
||||
expect(Object.keys(testObject).length).toEqual(7);
|
||||
expect(testObject).toHaveProperty('key');
|
||||
expect(typeof testObject['key']).toBe('string');
|
||||
expect(testObject).toHaveProperty('ext');
|
||||
expect(typeof testObject['ext']).toBe('string');
|
||||
expect(testObject).toHaveProperty('name');
|
||||
expect(typeof testObject['name']).toBe('string');
|
||||
expect(testObject).toHaveProperty('contents');
|
||||
expect(typeof testObject['contents']).toBe('string');
|
||||
expect(testObject).toHaveProperty('head');
|
||||
expect(typeof testObject['head']).toBe('string');
|
||||
expect(testObject).toHaveProperty('tail');
|
||||
expect(typeof testObject['tail']).toBe('string');
|
||||
expect(testObject).toHaveProperty('id');
|
||||
expect(typeof testObject['id']).toBe('string');
|
||||
});
|
||||
|
||||
it('adds multiple solutions if they exist', () => {
|
||||
expect.assertions(5);
|
||||
plugin(multiSolnsAST, file);
|
||||
const {
|
||||
data: { solutions }
|
||||
} = file;
|
||||
expect(solutions.length).toBe(3);
|
||||
expect(solutions[0].indexjs.contents).toBe("var x = 'y';");
|
||||
expect(solutions[1].indexhtml.contents).toBe(`<html>
|
||||
<body>
|
||||
solution number two
|
||||
</body>
|
||||
</html>`);
|
||||
expect(solutions[1].indexcss.contents).toBe(`body {
|
||||
background: white;
|
||||
}`);
|
||||
expect(solutions[2].indexjs.contents).toBe("var x = 'y3';");
|
||||
});
|
||||
|
||||
it('should reject solutions with editable region markers', () => {
|
||||
expect.assertions(1);
|
||||
expect(() => plugin(editableSolutionAST, file)).toThrow(
|
||||
'--fcc-editable-region-- should only appear in the --seed-contents--\n' +
|
||||
'section, not in --solutions--'
|
||||
);
|
||||
});
|
||||
|
||||
it('should have an output to match the snapshot', () => {
|
||||
plugin(mockAST, file);
|
||||
expect(file.data).toMatchSnapshot();
|
||||
});
|
||||
});
|
32
tools/challenge-parser/parser/plugins/add-tests.js
Normal file
32
tools/challenge-parser/parser/plugins/add-tests.js
Normal file
@ -0,0 +1,32 @@
|
||||
const chunk = require('lodash/chunk');
|
||||
const getAllBetween = require('./utils/between-headings');
|
||||
const mdastToHtml = require('./utils/mdast-to-html');
|
||||
|
||||
function plugin() {
|
||||
return transformer;
|
||||
|
||||
function transformer(tree, file) {
|
||||
const hintNodes = getAllBetween(tree, '--hints--');
|
||||
if (hintNodes.length % 2 !== 0)
|
||||
throw Error('Tests must be in (text, ```testString```) order');
|
||||
|
||||
const tests = chunk(hintNodes, 2).map(getTest);
|
||||
file.data.tests = tests;
|
||||
}
|
||||
}
|
||||
|
||||
function getTest(hintNodes) {
|
||||
const [textNode, testStringNode] = hintNodes;
|
||||
const text = mdastToHtml([textNode]);
|
||||
const testString = testStringNode.value;
|
||||
|
||||
if (!text) throw Error('text is missing from hint');
|
||||
// stub tests (i.e. text, but no testString) are allowed, but the md must
|
||||
// have a code block, even if it is empty.
|
||||
if (!testString && testString !== '')
|
||||
throw Error('testString (code block) is missing from hint');
|
||||
|
||||
return { text, testString };
|
||||
}
|
||||
|
||||
module.exports = plugin;
|
71
tools/challenge-parser/parser/plugins/add-tests.test.js
Normal file
71
tools/challenge-parser/parser/plugins/add-tests.test.js
Normal file
@ -0,0 +1,71 @@
|
||||
/* global describe it expect beforeEach */
|
||||
const simpleAST = require('../__fixtures__/ast-simple.json');
|
||||
const brokenHintsAST = require('../__fixtures__/ast-broken-hints.json');
|
||||
const addTests = require('./add-tests');
|
||||
|
||||
describe('add-tests plugin', () => {
|
||||
const plugin = addTests();
|
||||
let file = { data: {} };
|
||||
|
||||
beforeEach(() => {
|
||||
file = { data: {} };
|
||||
});
|
||||
|
||||
it('returns a function', () => {
|
||||
expect(typeof plugin).toEqual('function');
|
||||
});
|
||||
|
||||
it('adds a `tests` property to `file.data`', () => {
|
||||
plugin(simpleAST, file);
|
||||
|
||||
expect('tests' in file.data).toBe(true);
|
||||
});
|
||||
|
||||
it('adds test objects to the tests array following a schema', () => {
|
||||
expect.assertions(5);
|
||||
plugin(simpleAST, file);
|
||||
const testObject = file.data.tests[0];
|
||||
expect(Object.keys(testObject).length).toBe(2);
|
||||
expect(testObject).toHaveProperty('testString');
|
||||
expect(typeof testObject.testString).toBe('string');
|
||||
expect(testObject).toHaveProperty('text');
|
||||
expect(typeof testObject.text).toBe('string');
|
||||
});
|
||||
|
||||
// TODO: make this a bit more robust and informative
|
||||
it('should throw if a test pair is out of order', () => {
|
||||
expect.assertions(1);
|
||||
expect(() => plugin(brokenHintsAST, file)).toThrow(
|
||||
'testString (code block) is missing from hint'
|
||||
);
|
||||
});
|
||||
|
||||
it('preserves code whitespace in testStrings', () => {
|
||||
plugin(simpleAST, file);
|
||||
const testObject = file.data.tests[2];
|
||||
expect(testObject.testString).toBe(`// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}`);
|
||||
});
|
||||
|
||||
it('does not encode html', () => {
|
||||
plugin(simpleAST, file);
|
||||
const testObject = file.data.tests[1];
|
||||
expect(testObject.text).toBe('<p>Second hint with <code>code</code></p>');
|
||||
});
|
||||
|
||||
it('converts test text from md to html', () => {
|
||||
plugin(simpleAST, file);
|
||||
const testObject = file.data.tests[2];
|
||||
expect(testObject.text).toBe(
|
||||
'<p>Third <em>hint</em> with <code>code</code>' +
|
||||
' and <code>inline code</code></p>'
|
||||
);
|
||||
});
|
||||
|
||||
it('should have an output to match the snapshot', () => {
|
||||
plugin(simpleAST, file);
|
||||
expect(file.data).toMatchSnapshot();
|
||||
});
|
||||
});
|
27
tools/challenge-parser/parser/plugins/add-text.js
Normal file
27
tools/challenge-parser/parser/plugins/add-text.js
Normal file
@ -0,0 +1,27 @@
|
||||
const { isEmpty } = require('lodash');
|
||||
const getAllBetween = require('./utils/between-headings');
|
||||
const mdastToHTML = require('./utils/mdast-to-html');
|
||||
|
||||
function addText(sectionIds) {
|
||||
if (!sectionIds || !Array.isArray(sectionIds) || sectionIds.length <= 0) {
|
||||
throw new Error('addText must have an array of section ids supplied');
|
||||
}
|
||||
function transformer(tree, file) {
|
||||
for (const sectionId of sectionIds) {
|
||||
const textNodes = getAllBetween(tree, `--${sectionId}--`);
|
||||
const sectionText = mdastToHTML(textNodes);
|
||||
|
||||
if (!isEmpty(sectionText)) {
|
||||
file.data = {
|
||||
...file.data,
|
||||
[sectionId]: `<section id="${sectionId}">
|
||||
${sectionText}
|
||||
</section>`
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return transformer;
|
||||
}
|
||||
|
||||
module.exports = addText;
|
130
tools/challenge-parser/parser/plugins/add-text.test.js
Normal file
130
tools/challenge-parser/parser/plugins/add-text.test.js
Normal file
@ -0,0 +1,130 @@
|
||||
/* global describe it expect */
|
||||
const mockAST = require('../__fixtures__/ast-simple.json');
|
||||
// eslint-disable-next-line max-len
|
||||
const incorrectMarkersAST = require('../__fixtures__/ast-incorrect-markers.json');
|
||||
const realisticAST = require('../__fixtures__/ast-realistic.json');
|
||||
const addText = require('./add-text');
|
||||
|
||||
describe('add-text', () => {
|
||||
const descriptionId = 'description';
|
||||
const instructionsId = 'instructions';
|
||||
// const unexpectedField = 'does-not-exist';
|
||||
let file = { data: {} };
|
||||
|
||||
beforeEach(() => {
|
||||
file = { data: {} };
|
||||
});
|
||||
|
||||
it('should return a function', () => {
|
||||
const plugin = addText(['section']);
|
||||
|
||||
expect(typeof plugin).toEqual('function');
|
||||
});
|
||||
|
||||
it('throws when no argument or the incorrect argument is supplied', () => {
|
||||
expect.assertions(5);
|
||||
const expectedError = 'addText must have an array of section ids supplied';
|
||||
expect(() => {
|
||||
addText();
|
||||
}).toThrow(expectedError);
|
||||
expect(() => {
|
||||
addText('');
|
||||
}).toThrow(expectedError);
|
||||
expect(() => {
|
||||
addText({});
|
||||
}).toThrow(expectedError);
|
||||
expect(() => {
|
||||
addText(1);
|
||||
}).toThrow(expectedError);
|
||||
expect(() => {
|
||||
addText([]);
|
||||
}).toThrow(expectedError);
|
||||
});
|
||||
|
||||
it('should add a string relating to the section id to `file.data`', () => {
|
||||
const plugin = addText([descriptionId]);
|
||||
plugin(mockAST, file);
|
||||
const expectedText = 'Paragraph 1';
|
||||
expect(file.data[descriptionId]).toEqual(
|
||||
expect.stringContaining(expectedText)
|
||||
);
|
||||
});
|
||||
|
||||
it('should not add a string relating a different id to `file.data`', () => {
|
||||
const plugin = addText([descriptionId]);
|
||||
plugin(mockAST, file);
|
||||
// the following text is in the AST, but is associated with a different
|
||||
// marker (instructions)
|
||||
const expectedText = 'Paragraph 0';
|
||||
expect(file.data[descriptionId]).not.toEqual(
|
||||
expect.stringContaining(expectedText)
|
||||
);
|
||||
});
|
||||
|
||||
// TODO: do we need to add the ids to the section tags? Why not just have
|
||||
// <section>?
|
||||
it('should embed the text in sections with appropriate ids', () => {
|
||||
const plugin = addText([descriptionId, instructionsId]);
|
||||
plugin(mockAST, file);
|
||||
// the following text is in the AST, but is associated with a different
|
||||
// marker (instructions)
|
||||
const descriptionSectionText = `<section id="description">
|
||||
<p>Paragraph 1</p>
|
||||
<pre><code class="language-html">code example
|
||||
</code></pre>
|
||||
</section>`;
|
||||
expect(file.data[descriptionId]).toEqual(descriptionSectionText);
|
||||
const instructionsSectionText = `<section id="instructions">
|
||||
<p>Paragraph 0</p>
|
||||
<pre><code class="language-html">code example 0
|
||||
</code></pre>
|
||||
</section>`;
|
||||
expect(file.data[instructionsId]).toBe(instructionsSectionText);
|
||||
});
|
||||
|
||||
// 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);
|
||||
expect(file.data[descriptionId]).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should not escape html', () => {
|
||||
const plugin = addText([descriptionId]);
|
||||
plugin(realisticAST, file);
|
||||
const expected = `last <code>h2</code> element`;
|
||||
expect(file.data[descriptionId]).toEqual(expect.stringContaining(expected));
|
||||
});
|
||||
|
||||
it('should preserve nested html', () => {
|
||||
const plugin = addText([descriptionId]);
|
||||
plugin(realisticAST, file);
|
||||
const expected = `<blockquote>
|
||||
<p>Some text in a blockquote</p>
|
||||
<p>
|
||||
Some text in a blockquote, with <code>code</code>
|
||||
</p>
|
||||
</blockquote>`;
|
||||
expect(file.data[descriptionId]).toEqual(expect.stringContaining(expected));
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
it('should not add paragraphs when html elements are separated by whitespace', () => {
|
||||
const plugin = addText([instructionsId]);
|
||||
plugin(realisticAST, file);
|
||||
const expectedText1 = `<code>code</code> <tag>with more after a space</tag>`;
|
||||
const expectedText2 = `another pair of <strong>elements</strong> <em>with a space</em>`;
|
||||
expect(file.data[instructionsId]).toEqual(
|
||||
expect.stringContaining(expectedText1)
|
||||
);
|
||||
expect(file.data[instructionsId]).toEqual(
|
||||
expect.stringContaining(expectedText2)
|
||||
);
|
||||
});
|
||||
|
||||
it('should have an output to match the snapshot', () => {
|
||||
const plugin = addText([descriptionId, instructionsId]);
|
||||
plugin(mockAST, file);
|
||||
expect(file.data).toMatchSnapshot();
|
||||
});
|
||||
});
|
63
tools/challenge-parser/parser/plugins/add-video-question.js
Normal file
63
tools/challenge-parser/parser/plugins/add-video-question.js
Normal file
@ -0,0 +1,63 @@
|
||||
const { root } = require('mdast-builder');
|
||||
const getAllBetween = require('./utils/between-headings');
|
||||
const mdastToHtml = require('./utils/mdast-to-html');
|
||||
|
||||
const { splitOnThematicBreak } = require('./utils/split-on-thematic-break');
|
||||
|
||||
function plugin() {
|
||||
return transformer;
|
||||
|
||||
function transformer(tree, file) {
|
||||
const questionNodes = getAllBetween(tree, '--question--');
|
||||
if (questionNodes.length > 0) {
|
||||
const questionTree = root(questionNodes);
|
||||
const textNodes = getAllBetween(questionTree, '--text--');
|
||||
const answersNodes = getAllBetween(questionTree, '--answers--');
|
||||
const solutionNodes = getAllBetween(questionTree, '--video-solution--');
|
||||
|
||||
const question = getQuestion(textNodes, answersNodes, solutionNodes);
|
||||
|
||||
file.data.question = question;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getQuestion(textNodes, answersNodes, solutionNodes) {
|
||||
const text = mdastToHtml(textNodes);
|
||||
const answers = getAnswers(answersNodes);
|
||||
const solution = getSolution(solutionNodes);
|
||||
|
||||
if (!text) throw Error('text is missing from question');
|
||||
if (!answers) throw Error('answers are missing from question');
|
||||
if (!solution) throw Error('solution is missing from question');
|
||||
|
||||
// console.log({ text, answers, solution });
|
||||
return { text, answers, solution };
|
||||
}
|
||||
|
||||
function getAnswers(answersNodes) {
|
||||
const answerGroups = splitOnThematicBreak(answersNodes);
|
||||
return answerGroups.map(answer => mdastToHtml(answer));
|
||||
}
|
||||
|
||||
function getSolution(solutionNodes) {
|
||||
let solution;
|
||||
try {
|
||||
if (solutionNodes.length > 1) throw Error('Too many nodes');
|
||||
if (solutionNodes[0].children.length > 1)
|
||||
throw Error('Too many child nodes');
|
||||
const solutionString = solutionNodes[0].children[0].value;
|
||||
if (solutionString === '') throw Error('Non-empty string required');
|
||||
|
||||
solution = Number(solutionString);
|
||||
if (Number.isNaN(solution)) throw Error('Not a number');
|
||||
if (solution < 1) throw Error('Not positive number');
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
throw Error('A video solution should be a positive integer');
|
||||
}
|
||||
|
||||
return solution;
|
||||
}
|
||||
|
||||
module.exports = plugin;
|
@ -0,0 +1,74 @@
|
||||
/* global describe it expect beforeEach */
|
||||
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 addVideoQuestion = require('./add-video-question');
|
||||
|
||||
describe('add-video-question plugin', () => {
|
||||
const plugin = addVideoQuestion();
|
||||
let file = { data: {} };
|
||||
|
||||
beforeEach(() => {
|
||||
file = { data: {} };
|
||||
});
|
||||
|
||||
it('returns a function', () => {
|
||||
expect(typeof plugin).toEqual('function');
|
||||
});
|
||||
|
||||
it('adds a `question` property to `file.data`', () => {
|
||||
plugin(mockVideoAST, file);
|
||||
|
||||
expect('question' in file.data).toBe(true);
|
||||
});
|
||||
|
||||
it('should generate a question object from a video challenge AST', () => {
|
||||
expect.assertions(8);
|
||||
plugin(mockVideoAST, file);
|
||||
const testObject = file.data.question;
|
||||
expect(Object.keys(testObject).length).toBe(3);
|
||||
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('string');
|
||||
});
|
||||
|
||||
it('should convert question and answer markdown into html', () => {
|
||||
plugin(mockVideoAST, file);
|
||||
const testObject = file.data.question;
|
||||
expect(Object.keys(testObject).length).toBe(3);
|
||||
expect(testObject.text).toBe(
|
||||
'<p>Question line 1</p>\n' +
|
||||
`<pre><code class="language-js"> var x = 'y';\n` +
|
||||
'</code></pre>'
|
||||
);
|
||||
expect(testObject.solution).toBe(3);
|
||||
expect(testObject.answers[0]).toBe('<p>Some inline <code>code</code></p>');
|
||||
expect(testObject.answers[1]).toBe(`<p>Some <em>italics</em></p>
|
||||
<p>A second answer paragraph.</p>`);
|
||||
expect(testObject.answers[2]).toBe(
|
||||
'<p><code> code in </code> code tags</p>'
|
||||
);
|
||||
});
|
||||
|
||||
// TODO: consider testing for more specific messages. Ideally we them to say
|
||||
// 'The md is missing "x"', so it's obvious how to fix things.
|
||||
it('should throw if the subheadings are outside the question heading', () => {
|
||||
expect.assertions(1);
|
||||
expect(() => plugin(videoOutOfOrderAST)).toThrow();
|
||||
});
|
||||
|
||||
it('should NOT throw if there is no question', () => {
|
||||
expect.assertions(1);
|
||||
expect(() => plugin(simpleAST)).not.toThrow();
|
||||
});
|
||||
|
||||
it('should match the video snapshot', () => {
|
||||
plugin(mockVideoAST, file);
|
||||
expect(file.data).toMatchSnapshot();
|
||||
});
|
||||
});
|
91
tools/challenge-parser/parser/plugins/replace-imports.js
Normal file
91
tools/challenge-parser/parser/plugins/replace-imports.js
Normal file
@ -0,0 +1,91 @@
|
||||
const path = require('path');
|
||||
const { read } = require('to-vfile');
|
||||
const modifyChildren = require('unist-util-modify-children');
|
||||
const remark = require('remark');
|
||||
const remove = require('unist-util-remove');
|
||||
const visit = require('unist-util-visit');
|
||||
const { selectAll } = require('unist-util-select');
|
||||
const { isEmpty } = require('lodash');
|
||||
|
||||
const { editableRegionMarker } = require('./add-seed');
|
||||
const tableAndStrikeThrough = require('./table-and-strikethrough');
|
||||
|
||||
async function parse(file) {
|
||||
return await remark()
|
||||
.use(tableAndStrikeThrough)
|
||||
.parse(file);
|
||||
}
|
||||
|
||||
function plugin() {
|
||||
return transformer;
|
||||
|
||||
function transformer(tree, file, next) {
|
||||
const importedFiles = selectAll('leafDirective[name=import]', tree);
|
||||
if (!file) {
|
||||
next('replace-imports must be passed a file');
|
||||
return;
|
||||
}
|
||||
if (isEmpty(importedFiles)) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
const importPromises = importedFiles.map(async ({ attributes }) => {
|
||||
const { from, component } = attributes;
|
||||
const location = path.resolve(file.dirname, from);
|
||||
return await read(location)
|
||||
.then(parse)
|
||||
.then(importedFile => {
|
||||
function modifier(node, index, parent) {
|
||||
const { type, name, attributes } = node;
|
||||
const target = attributes ? attributes.component : null;
|
||||
if (
|
||||
type === 'leafDirective' &&
|
||||
name === 'use' &&
|
||||
target === component
|
||||
) {
|
||||
if (!validateImports(importedFile))
|
||||
throw Error(
|
||||
'Importing files containing ' +
|
||||
editableRegionMarker +
|
||||
's is not supported.'
|
||||
);
|
||||
|
||||
parent.children.splice(index, 1, ...importedFile.children);
|
||||
}
|
||||
}
|
||||
|
||||
const modify = modifyChildren(modifier);
|
||||
modify(tree);
|
||||
});
|
||||
});
|
||||
|
||||
// We're not interested in the results of importing, we just want to
|
||||
// modify the tree and pass that new tree to follow plugins - as a result,
|
||||
// we can't just use .then(next), as it would pass the array into next.
|
||||
// Also, we remove the import statements here.
|
||||
Promise.all(importPromises)
|
||||
.then(() => {
|
||||
remove(tree, { type: 'leafDirective', name: 'import' });
|
||||
next();
|
||||
})
|
||||
.catch(next);
|
||||
}
|
||||
}
|
||||
|
||||
function validateImports(fileTree) {
|
||||
let valid = true;
|
||||
|
||||
function visitor({ value }) {
|
||||
if (value && value.includes(editableRegionMarker)) {
|
||||
valid = false;
|
||||
return visit.EXIT;
|
||||
} else {
|
||||
return visit.CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
visit(fileTree, visitor);
|
||||
return valid;
|
||||
}
|
||||
|
||||
module.exports = plugin;
|
231
tools/challenge-parser/parser/plugins/replace-imports.test.js
Normal file
231
tools/challenge-parser/parser/plugins/replace-imports.test.js
Normal file
@ -0,0 +1,231 @@
|
||||
/* global describe it expect */
|
||||
const path = require('path');
|
||||
const cloneDeep = require('lodash/cloneDeep');
|
||||
const toVfile = require('to-vfile');
|
||||
const selectAll = require('unist-util-select').selectAll;
|
||||
|
||||
const addImports = require('./replace-imports');
|
||||
const originalImportsAST = require('../__fixtures__/ast-imports.json');
|
||||
const originalImportsTwoAST = require('../__fixtures__/ast-imports-two.json');
|
||||
const originalSimpleAST = require('../__fixtures__/ast-simple.json');
|
||||
const originalMarkerAST = require('../__fixtures__/ast-marker-imports.json');
|
||||
|
||||
describe('replace-imports', () => {
|
||||
let importsAST;
|
||||
let importsTwoAST;
|
||||
let simpleAST;
|
||||
let markerAST;
|
||||
let correctFile;
|
||||
let incorrectFile;
|
||||
|
||||
beforeEach(() => {
|
||||
importsAST = cloneDeep(originalImportsAST);
|
||||
importsTwoAST = cloneDeep(originalImportsTwoAST);
|
||||
simpleAST = cloneDeep(originalSimpleAST);
|
||||
markerAST = cloneDeep(originalMarkerAST);
|
||||
correctFile = toVfile(
|
||||
path.resolve(__dirname, '../__fixtures__/with-imports.md')
|
||||
);
|
||||
incorrectFile = toVfile(
|
||||
path.resolve(__dirname, '../__fixtures__/incorrect-path/with-imports.md')
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a function', () => {
|
||||
expect.assertions(1);
|
||||
const plugin = addImports();
|
||||
|
||||
expect(typeof plugin).toEqual('function');
|
||||
});
|
||||
|
||||
it('should fail when the imported file is null', done => {
|
||||
const plugin = addImports();
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done();
|
||||
} else {
|
||||
done('An error should have been thrown by addImports');
|
||||
}
|
||||
};
|
||||
plugin(importsAST, null, next);
|
||||
});
|
||||
|
||||
it('should proceed when the imported file exists', done => {
|
||||
const plugin = addImports();
|
||||
plugin(importsAST, correctFile, done);
|
||||
});
|
||||
|
||||
it('should fail when the imported file cannot be found', done => {
|
||||
const plugin = addImports();
|
||||
|
||||
// we have to rely on the next callback, because that is how you get error
|
||||
// messages out of transformers
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done();
|
||||
} else {
|
||||
done('An error should have been thrown by addImports');
|
||||
}
|
||||
};
|
||||
plugin(importsAST, incorrectFile, next);
|
||||
});
|
||||
|
||||
it('should modify the tree when there are imports', done => {
|
||||
expect.assertions(1);
|
||||
const plugin = addImports();
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
expect(importsAST).not.toEqual(originalImportsAST);
|
||||
done();
|
||||
}
|
||||
};
|
||||
plugin(importsAST, correctFile, next);
|
||||
});
|
||||
|
||||
it('should NOT modify the tree when there are NO imports', done => {
|
||||
expect.assertions(1);
|
||||
const plugin = addImports();
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
expect(simpleAST).toEqual(originalSimpleAST);
|
||||
done();
|
||||
}
|
||||
};
|
||||
plugin(simpleAST, correctFile, next);
|
||||
});
|
||||
|
||||
it('should remove all import statements', done => {
|
||||
expect.assertions(2);
|
||||
const selector = 'leafDirective[name=import]';
|
||||
const plugin = addImports();
|
||||
const importNodes = selectAll(selector, importsAST);
|
||||
|
||||
expect(importNodes.length).toBe(1);
|
||||
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
const importNodes = selectAll(selector, importsAST);
|
||||
expect(importNodes.length).toBe(0);
|
||||
done();
|
||||
}
|
||||
};
|
||||
plugin(importsAST, correctFile, next);
|
||||
});
|
||||
|
||||
it('should remove all matching ::use statements', done => {
|
||||
expect.assertions(2);
|
||||
const selector = 'leafDirective[name=use]';
|
||||
const plugin = addImports();
|
||||
const components = selectAll(selector, importsAST);
|
||||
|
||||
// one matching component and two other jsx nodes
|
||||
expect(components.length).toBe(1);
|
||||
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
const components = selectAll(selector, importsAST);
|
||||
expect(components.length).toBe(0);
|
||||
done();
|
||||
}
|
||||
};
|
||||
plugin(importsAST, correctFile, next);
|
||||
});
|
||||
|
||||
it('should replace the ::use statement with the imported content', done => {
|
||||
// checks the contents of script.md are there after the import step
|
||||
expect.assertions(2);
|
||||
const plugin = addImports();
|
||||
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
const jsNodes = selectAll('code[lang=js]', importsAST);
|
||||
expect(jsNodes.length).toBe(4);
|
||||
|
||||
const codeValues = jsNodes.map(({ value }) => value);
|
||||
expect(codeValues).toEqual(
|
||||
expect.arrayContaining([
|
||||
`for (let index = 0; index < array.length; index++) {
|
||||
const element = array[index];
|
||||
// imported from script.md
|
||||
}`
|
||||
])
|
||||
);
|
||||
done();
|
||||
}
|
||||
};
|
||||
plugin(importsAST, correctFile, next);
|
||||
});
|
||||
|
||||
it('should handle multiple import statements', done => {
|
||||
// checks the contents of script.md are there after the import step
|
||||
expect.assertions(4);
|
||||
const plugin = addImports();
|
||||
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
const jsNodes = selectAll('code[lang=js]', importsTwoAST);
|
||||
expect(jsNodes.length).toBe(4);
|
||||
|
||||
const codeValues = jsNodes.map(({ value }) => value);
|
||||
expect(codeValues).toEqual(
|
||||
expect.arrayContaining([
|
||||
`for (let index = 0; index < array.length; index++) {
|
||||
const element = array[index];
|
||||
// imported from script.md
|
||||
}`
|
||||
])
|
||||
);
|
||||
const cssNodes = selectAll('code[lang=css]', importsTwoAST);
|
||||
expect(cssNodes.length).toBe(2);
|
||||
|
||||
const cssValues = cssNodes.map(({ value }) => value);
|
||||
expect(cssValues).toEqual(
|
||||
expect.arrayContaining([
|
||||
`div {
|
||||
background: red
|
||||
}`
|
||||
])
|
||||
);
|
||||
done();
|
||||
}
|
||||
};
|
||||
plugin(importsTwoAST, correctFile, next);
|
||||
});
|
||||
|
||||
it('should reject imported files with editable region markers', done => {
|
||||
const plugin = addImports();
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done();
|
||||
} else {
|
||||
done('An error should have been thrown by addImports');
|
||||
}
|
||||
};
|
||||
plugin(markerAST, correctFile, next);
|
||||
});
|
||||
|
||||
it('should have an output to match the snapshot', done => {
|
||||
const plugin = addImports();
|
||||
const next = err => {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
expect(importsAST).toMatchSnapshot();
|
||||
done();
|
||||
}
|
||||
};
|
||||
plugin(importsAST, correctFile, next);
|
||||
});
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var strikethrough = require('micromark-extension-gfm-strikethrough');
|
||||
var table = require('micromark-extension-gfm-table');
|
||||
var fromMarkdown = require('mdast-util-gfm/from-markdown');
|
||||
|
||||
module.exports = tableAndStrikethrough;
|
||||
|
||||
function tableAndStrikethrough() {
|
||||
var data = this.data();
|
||||
|
||||
add('micromarkExtensions', strikethrough());
|
||||
add('micromarkExtensions', table);
|
||||
add('fromMarkdownExtensions', fromMarkdown);
|
||||
|
||||
function add(field, value) {
|
||||
if (data[field]) data[field].push(value);
|
||||
else data[field] = [value];
|
||||
}
|
||||
}
|
||||
|
||||
// Based on remark-gfm, extended as described in
|
||||
// https://github.com/remarkjs/remark/tree/main/packages/remark-parse#extending-the-parser
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"type": "leafDirective",
|
||||
"name": "id",
|
||||
"attributes": { "id": "html-key" },
|
||||
"children": [],
|
||||
"position": {
|
||||
"start": { "line": 29, "column": 1, "offset": 200 },
|
||||
"end": { "line": 29, "column": 16, "offset": 215 }
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
"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": []
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "html",
|
||||
"value": "<code>",
|
||||
"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": "</code>",
|
||||
"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": "<div>",
|
||||
"position": {
|
||||
"start": { "line": 3, "column": 57, "offset": 75 },
|
||||
"end": { "line": 3, "column": 62, "offset": 80 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "html",
|
||||
"value": "<span>",
|
||||
"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": "</span>",
|
||||
"position": {
|
||||
"start": { "line": 3, "column": 85, "offset": 103 },
|
||||
"end": { "line": 3, "column": 92, "offset": 110 },
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "html",
|
||||
"value": "</div>",
|
||||
"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": []
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
[
|
||||
{
|
||||
"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": "<code>",
|
||||
"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": "</code>",
|
||||
"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": []
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,66 @@
|
||||
{
|
||||
"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": []
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
{
|
||||
"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]
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"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": []
|
||||
}
|
||||
}
|
@ -0,0 +1,395 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`between-headings should match the hints snapshot 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 11,
|
||||
"line": 19,
|
||||
"offset": 142,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 19,
|
||||
"offset": 132,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "First hint",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 11,
|
||||
"line": 19,
|
||||
"offset": 142,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 19,
|
||||
"offset": 132,
|
||||
},
|
||||
},
|
||||
"type": "paragraph",
|
||||
},
|
||||
Object {
|
||||
"lang": "js",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 23,
|
||||
"offset": 166,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 21,
|
||||
"offset": 144,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "// test code",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 18,
|
||||
"line": 25,
|
||||
"offset": 185,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 25,
|
||||
"offset": 168,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "Second hint with ",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 24,
|
||||
"line": 25,
|
||||
"offset": 191,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 18,
|
||||
"line": 25,
|
||||
"offset": 185,
|
||||
},
|
||||
},
|
||||
"type": "html",
|
||||
"value": "<code>",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 28,
|
||||
"line": 25,
|
||||
"offset": 195,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 24,
|
||||
"line": 25,
|
||||
"offset": 191,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "code",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 35,
|
||||
"line": 25,
|
||||
"offset": 202,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 28,
|
||||
"line": 25,
|
||||
"offset": 195,
|
||||
},
|
||||
},
|
||||
"type": "html",
|
||||
"value": "</code>",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 35,
|
||||
"line": 25,
|
||||
"offset": 202,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 25,
|
||||
"offset": 168,
|
||||
},
|
||||
},
|
||||
"type": "paragraph",
|
||||
},
|
||||
Object {
|
||||
"lang": "js",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 29,
|
||||
"offset": 231,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 27,
|
||||
"offset": 204,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "// more test code",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 7,
|
||||
"line": 31,
|
||||
"offset": 239,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 31,
|
||||
"offset": 233,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "Third ",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 12,
|
||||
"line": 31,
|
||||
"offset": 244,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 8,
|
||||
"line": 31,
|
||||
"offset": 240,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "hint",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 13,
|
||||
"line": 31,
|
||||
"offset": 245,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 7,
|
||||
"line": 31,
|
||||
"offset": 239,
|
||||
},
|
||||
},
|
||||
"type": "emphasis",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 19,
|
||||
"line": 31,
|
||||
"offset": 251,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 13,
|
||||
"line": 31,
|
||||
"offset": 245,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": " with ",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 25,
|
||||
"line": 31,
|
||||
"offset": 257,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 19,
|
||||
"line": 31,
|
||||
"offset": 251,
|
||||
},
|
||||
},
|
||||
"type": "html",
|
||||
"value": "<code>",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 29,
|
||||
"line": 31,
|
||||
"offset": 261,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 25,
|
||||
"line": 31,
|
||||
"offset": 257,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "code",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 36,
|
||||
"line": 31,
|
||||
"offset": 268,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 29,
|
||||
"line": 31,
|
||||
"offset": 261,
|
||||
},
|
||||
},
|
||||
"type": "html",
|
||||
"value": "</code>",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 41,
|
||||
"line": 31,
|
||||
"offset": 273,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 36,
|
||||
"line": 31,
|
||||
"offset": 268,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": " and ",
|
||||
},
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 54,
|
||||
"line": 31,
|
||||
"offset": 286,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 41,
|
||||
"line": 31,
|
||||
"offset": 273,
|
||||
},
|
||||
},
|
||||
"type": "inlineCode",
|
||||
"value": "inline code",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 54,
|
||||
"line": 31,
|
||||
"offset": 286,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 31,
|
||||
"offset": 233,
|
||||
},
|
||||
},
|
||||
"type": "paragraph",
|
||||
},
|
||||
Object {
|
||||
"lang": "js",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 38,
|
||||
"offset": 353,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 33,
|
||||
"offset": 288,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "// more test code
|
||||
if(let x of xs) {
|
||||
console.log(x);
|
||||
}",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`between-headings should match the instructions snapshot 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 12,
|
||||
"line": 11,
|
||||
"offset": 89,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 11,
|
||||
"offset": 78,
|
||||
},
|
||||
},
|
||||
"type": "text",
|
||||
"value": "Paragraph 0",
|
||||
},
|
||||
],
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 12,
|
||||
"line": 11,
|
||||
"offset": 89,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 11,
|
||||
"offset": 78,
|
||||
},
|
||||
},
|
||||
"type": "paragraph",
|
||||
},
|
||||
Object {
|
||||
"lang": "html",
|
||||
"meta": null,
|
||||
"position": Object {
|
||||
"end": Object {
|
||||
"column": 4,
|
||||
"line": 15,
|
||||
"offset": 117,
|
||||
},
|
||||
"start": Object {
|
||||
"column": 1,
|
||||
"line": 13,
|
||||
"offset": 91,
|
||||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "code example 0",
|
||||
},
|
||||
]
|
||||
`;
|
@ -0,0 +1,46 @@
|
||||
const between = require('unist-util-find-all-between');
|
||||
const find = require('unist-util-find');
|
||||
const findAfter = require('unist-util-find-after');
|
||||
const findAllAfter = require('unist-util-find-all-after');
|
||||
|
||||
function getAllBetween(tree, marker) {
|
||||
const start = find(tree, {
|
||||
type: 'heading',
|
||||
children: [
|
||||
{
|
||||
type: 'text',
|
||||
value: marker
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
if (!start) return [];
|
||||
|
||||
const isEnd = node => {
|
||||
return (
|
||||
node.type === 'heading' && node.depth <= start.depth && isMarker(node)
|
||||
);
|
||||
};
|
||||
|
||||
const isMarker = node => {
|
||||
if (node.children && node.children[0]) {
|
||||
const child = node.children[0];
|
||||
return (
|
||||
child.type === 'text' &&
|
||||
child.value.startsWith('--') &&
|
||||
child.value.endsWith('--')
|
||||
);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const end = findAfter(tree, start, isEnd);
|
||||
|
||||
const targetNodes = end
|
||||
? between(tree, start, end)
|
||||
: findAllAfter(tree, start);
|
||||
return targetNodes;
|
||||
}
|
||||
|
||||
module.exports = getAllBetween;
|
@ -0,0 +1,51 @@
|
||||
/* global expect*/
|
||||
const isArray = require('lodash/isArray');
|
||||
const find = require('unist-util-find');
|
||||
const { root } = require('mdast-builder');
|
||||
|
||||
const getAllBetween = require('./between-headings');
|
||||
const simpleAst = require('../../__fixtures__/ast-simple.json');
|
||||
const extraHeadingAst = require('../../__fixtures__/ast-extra-heading.json');
|
||||
|
||||
describe('between-headings', () => {
|
||||
it('should return an array', () => {
|
||||
expect.assertions(1);
|
||||
const actual = getAllBetween(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--');
|
||||
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--');
|
||||
expect(
|
||||
find(root(actual), {
|
||||
value: 'this should still be inside --description--'
|
||||
})
|
||||
).not.toBeUndefined();
|
||||
});
|
||||
|
||||
it('should include the rest of the AST if there is no end marker', () => {
|
||||
expect.assertions(2);
|
||||
const actual = getAllBetween(extraHeadingAst, '--solutions--');
|
||||
expect(actual.length > 0).toBe(true);
|
||||
expect(
|
||||
find(root(actual), { value: 'body {\n background: white;\n}' })
|
||||
).not.toBeUndefined();
|
||||
});
|
||||
|
||||
it('should match the hints snapshot', () => {
|
||||
const actual = getAllBetween(simpleAst, '--hints--');
|
||||
expect(actual).toMatchSnapshot();
|
||||
});
|
||||
it('should match the instructions snapshot', () => {
|
||||
const actual = getAllBetween(simpleAst, '--instructions--');
|
||||
expect(actual).toMatchSnapshot();
|
||||
});
|
||||
});
|
@ -0,0 +1,84 @@
|
||||
const is = require('unist-util-is');
|
||||
const position = require('unist-util-position');
|
||||
const { isEmpty } = require('lodash');
|
||||
|
||||
const getId = require('./get-id');
|
||||
|
||||
const keyToSection = {
|
||||
head: 'before-user-code',
|
||||
tail: 'after-user-code'
|
||||
};
|
||||
const supportedLanguages = ['js', 'css', 'html', 'jsx', 'py'];
|
||||
|
||||
function defaultFile(lang, id) {
|
||||
return {
|
||||
key: `index${lang}`,
|
||||
ext: lang,
|
||||
name: 'index',
|
||||
contents: '',
|
||||
head: '',
|
||||
tail: '',
|
||||
id
|
||||
};
|
||||
}
|
||||
|
||||
function getFileVisitor(seeds, seedKey, validate) {
|
||||
return (node, index, parent) => {
|
||||
if (is(node, 'root')) return;
|
||||
if (is(node, 'code')) {
|
||||
codeToData(node, seeds, seedKey, validate);
|
||||
return;
|
||||
}
|
||||
idToData(node, index, parent, seeds);
|
||||
};
|
||||
}
|
||||
|
||||
function codeToData(node, seeds, seedKey, validate) {
|
||||
if (validate) validate(node);
|
||||
const lang = node.lang;
|
||||
if (!supportedLanguages.includes(lang))
|
||||
throw Error(`On line ${
|
||||
position.start(node).line
|
||||
} '${lang}' is not a supported language.
|
||||
Please use one of js, css, html, jsx or py
|
||||
`);
|
||||
|
||||
const key = `index${lang}`;
|
||||
const id = seeds[key] ? seeds[key].id : '';
|
||||
// the contents will be missing if there is an id preceding this code
|
||||
// block.
|
||||
if (!seeds[key]) {
|
||||
seeds[key] = defaultFile(lang, id);
|
||||
}
|
||||
if (isEmpty(node.value) && seedKey !== 'contents') {
|
||||
const section = keyToSection[seedKey];
|
||||
throw Error(`Empty code block in --${section}-- section`);
|
||||
}
|
||||
|
||||
seeds[key][seedKey] = isEmpty(seeds[key][seedKey])
|
||||
? node.value
|
||||
: seeds[key][seedKey] + '\n' + node.value;
|
||||
}
|
||||
|
||||
function idToData(node, index, parent, seeds) {
|
||||
const id = getId(node);
|
||||
|
||||
// If this is reached, the node type is neither root nor code. If it is not
|
||||
// an id, there must be a syntax error.
|
||||
if (!id) {
|
||||
throw Error(
|
||||
'Unexpected syntax in seed/solution. Must be ::id{#id} or a code ' +
|
||||
'block (```) \n'
|
||||
);
|
||||
}
|
||||
const codeNode = parent.children[index + 1];
|
||||
if (codeNode && is(codeNode, 'code')) {
|
||||
const key = `index${codeNode.lang}`;
|
||||
if (seeds[key]) throw Error('::id{#id}s must come before code blocks');
|
||||
seeds[key] = defaultFile(codeNode.lang, id);
|
||||
} else {
|
||||
throw Error('::id{#id}s must come before code blocks');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.getFileVisitor = getFileVisitor;
|
@ -0,0 +1,33 @@
|
||||
describe('get-file-visitor', () => {
|
||||
it('should join code with newlines', () => {
|
||||
/* i.e. if you've got two js code blocks it should do this
|
||||
|
||||
```js
|
||||
one
|
||||
```
|
||||
|
||||
```js
|
||||
two
|
||||
```
|
||||
|
||||
become
|
||||
|
||||
```js
|
||||
one
|
||||
two
|
||||
```
|
||||
|
||||
not
|
||||
|
||||
```js
|
||||
onetwo
|
||||
```
|
||||
or
|
||||
```js
|
||||
|
||||
one
|
||||
two
|
||||
```
|
||||
*/
|
||||
});
|
||||
});
|
8
tools/challenge-parser/parser/plugins/utils/get-id.js
Normal file
8
tools/challenge-parser/parser/plugins/utils/get-id.js
Normal file
@ -0,0 +1,8 @@
|
||||
// getId expects the image reference node to be the sole node in a paragraph
|
||||
function getId(node) {
|
||||
const { type, name, attributes } = node;
|
||||
if (type !== 'leafDirective' || name !== 'id' || !attributes) return null;
|
||||
return attributes.id;
|
||||
}
|
||||
|
||||
module.exports = getId;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user