Skip to content

Commit 2ceb562

Browse files
committed
feat: Add support for querystring-like in 'gist:' directives
feat: Add support for line highlighting chore: Update dependencies
1 parent 5006147 commit 2ceb562

File tree

8 files changed

+3296
-213
lines changed

8 files changed

+3296
-213
lines changed

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,19 @@
3939
"devDependencies": {
4040
"babel-cli": "^6.26.0",
4141
"babel-core": "^6.26.3",
42+
"babel-eslint": "^8.2.6",
4243
"babel-plugin-add-module-exports": "^0.2.1",
4344
"babel-plugin-transform-object-rest-spread": "^6.26.0",
4445
"babel-preset-env": "^1.7.0",
4546
"babel-preset-react": "^6.24.1",
46-
"eslint": "^5.0.1",
47+
"eslint": "^5.1.0",
4748
"eslint-config-prettier": "^2.9.0",
49+
"eslint-plugin-jest": "^21.18.0",
50+
"eslint-plugin-json": "^1.2.0",
4851
"eslint-plugin-filenames": "^1.3.2",
49-
"eslint-plugin-prettier": "^2.6.1",
52+
"eslint-plugin-prettier": "^2.6.2",
5053
"husky": "^0.14.3",
51-
"jest": "^23.2.0",
54+
"jest": "^23.4.1",
5255
"lint-staged": "^7.2.0",
5356
"prettier": "^1.13.7",
5457
"react": "^16.4.1",
@@ -58,6 +61,8 @@
5861
},
5962
"dependencies": {
6063
"async-unist-util-visit": "^1.0.0",
64+
"cheerio": "^1.0.0-rc.2",
65+
"parse-numeric-range": "^0.0.2",
6166
"request": "^2.87.0",
6267
"request-promise": "^4.2.2"
6368
},
@@ -89,6 +94,10 @@
8994
]
9095
},
9196
"eslintConfig": {
97+
"parser": "babel-eslint",
98+
"parserOptions": {
99+
"sourceType": "module"
100+
},
92101
"extends": [
93102
"eslint:recommended",
94103
"prettier"

specs/__mocks__/3.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"description":".2016.08.31.stream-redirection",
3+
"public":true,
4+
"created_at":"2018-06-28T21:56:26.000-05:00",
5+
"files":[".2016.08.31.stream-redirection","example.sh","syntax.text"],
6+
"owner":"weirdpattern",
7+
"div":"<div id=\"gist90436059\" class=\"gist\">\n <div class=\"gist-file\">\n <div class=\"gist-data\">\n <div class=\"js-gist-file-update-container js-task-list-container file-box\">\n <div id=\"file-2016-08-31-stream-redirection\" class=\"file\">\n \n\n <div itemprop=\"text\" class=\"blob-wrapper data type-text\">\n <table class=\"highlight tab-size js-file-line-container\" data-tab-size=\"8\">\n <tr>\n <td id=\"file-2016-08-31-stream-redirection-L1\" class=\"blob-num js-line-number\" data-line-number=\"1\"></td>\n <td id=\"file-2016-08-31-stream-redirection-LC1\" class=\"blob-code blob-code-inner js-file-line\">2016.08.31.stream-redirection</td>\n </tr>\n</table>\n\n\n </div>\n\n </div>\n</div>\n\n </div>\n <div class=\"gist-meta\">\n <a href=\"https://gist.github.com/weirdpattern/ce54fdb1e5621b5966e146026995b974/raw/83e7ad9d06525f3becfafb2f32ffa3122e8e846e/.2016.08.31.stream-redirection\" style=\"float:right\">view raw</a>\n <a href=\"https://gist.github.com/weirdpattern/ce54fdb1e5621b5966e146026995b974#file-2016-08-31-stream-redirection\">.2016.08.31.stream-redirection</a>\n hosted with &#10084; by <a href=\"https://github.com\">GitHub</a>\n </div>\n </div>\n <div class=\"gist-file\">\n <div class=\"gist-data\">\n <div class=\"js-gist-file-update-container js-task-list-container file-box\">\n <div id=\"file-example-sh\" class=\"file\">\n \n\n <div itemprop=\"text\" class=\"blob-wrapper data type-shell\">\n <table class=\"highlight tab-size js-file-line-container\" data-tab-size=\"8\">\n <tr>\n <td id=\"file-example-sh-L1\" class=\"blob-num js-line-number\" data-line-number=\"1\"></td>\n <td id=\"file-example-sh-LC1\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c\"><span class=\"pl-c\">#</span> no redirection</span></td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L2\" class=\"blob-num js-line-number\" data-line-number=\"2\"></td>\n <td id=\"file-example-sh-LC2\" class=\"blob-code blob-code-inner js-file-line\">$ <span class=\"pl-c1\">echo</span> <span class=\"pl-s\"><span class=\"pl-pds\">&#39;</span>hello<span class=\"pl-pds\">&#39;</span></span></td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L3\" class=\"blob-num js-line-number\" data-line-number=\"3\"></td>\n <td id=\"file-example-sh-LC3\" class=\"blob-code blob-code-inner js-file-line\"> hello</td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L4\" class=\"blob-num js-line-number\" data-line-number=\"4\"></td>\n <td id=\"file-example-sh-LC4\" class=\"blob-code blob-code-inner js-file-line\"> </td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L5\" class=\"blob-num js-line-number\" data-line-number=\"5\"></td>\n <td id=\"file-example-sh-LC5\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c\"><span class=\"pl-c\">#</span> redirects standard error (no error in this case)</span></td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L6\" class=\"blob-num js-line-number\" data-line-number=\"6\"></td>\n <td id=\"file-example-sh-LC6\" class=\"blob-code blob-code-inner js-file-line\">$ <span class=\"pl-c1\">echo</span> <span class=\"pl-s\"><span class=\"pl-pds\">&#39;</span>hello<span class=\"pl-pds\">&#39;</span></span> <span class=\"pl-k\">2&gt;</span> /dev/null</td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L7\" class=\"blob-num js-line-number\" data-line-number=\"7\"></td>\n <td id=\"file-example-sh-LC7\" class=\"blob-code blob-code-inner js-file-line\"> hello</td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L8\" class=\"blob-num js-line-number\" data-line-number=\"8\"></td>\n <td id=\"file-example-sh-LC8\" class=\"blob-code blob-code-inner js-file-line\"> </td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L9\" class=\"blob-num js-line-number\" data-line-number=\"9\"></td>\n <td id=\"file-example-sh-LC9\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c\"><span class=\"pl-c\">#</span> redirects standard out to /dev/null (so no output) </span></td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L10\" class=\"blob-num js-line-number\" data-line-number=\"10\"></td>\n <td id=\"file-example-sh-LC10\" class=\"blob-code blob-code-inner js-file-line\">$ <span class=\"pl-c1\">echo</span> <span class=\"pl-s\"><span class=\"pl-pds\">&#39;</span>hello<span class=\"pl-pds\">&#39;</span></span> <span class=\"pl-k\">1&gt;</span> /dev/null </td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L11\" class=\"blob-num js-line-number\" data-line-number=\"11\"></td>\n <td id=\"file-example-sh-LC11\" class=\"blob-code blob-code-inner js-file-line\"> </td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L12\" class=\"blob-num js-line-number\" data-line-number=\"12\"></td>\n <td id=\"file-example-sh-LC12\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c\"><span class=\"pl-c\">#</span> redirects everything to /dev/null (so no output)</span></td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L13\" class=\"blob-num js-line-number\" data-line-number=\"13\"></td>\n <td id=\"file-example-sh-LC13\" class=\"blob-code blob-code-inner js-file-line\">$ <span class=\"pl-c1\">echo</span> <span class=\"pl-s\"><span class=\"pl-pds\">&#39;</span>hello<span class=\"pl-pds\">&#39;</span></span> <span class=\"pl-k\">&amp;</span><span class=\"pl-k\">&gt;</span> /dev/null </td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L14\" class=\"blob-num js-line-number\" data-line-number=\"14\"></td>\n <td id=\"file-example-sh-LC14\" class=\"blob-code blob-code-inner js-file-line\">\n</td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L15\" class=\"blob-num js-line-number\" data-line-number=\"15\"></td>\n <td id=\"file-example-sh-LC15\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c\"><span class=\"pl-c\">#</span> no redirection (causing error) </span></td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L16\" class=\"blob-num js-line-number\" data-line-number=\"16\"></td>\n <td id=\"file-example-sh-LC16\" class=\"blob-code blob-code-inner js-file-line\">$ unlink unexisting-file.sh </td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L17\" class=\"blob-num js-line-number\" data-line-number=\"17\"></td>\n <td id=\"file-example-sh-LC17\" class=\"blob-code blob-code-inner js-file-line\"> unlink: unexisting-file.sh: No such file or directory</td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L18\" class=\"blob-num js-line-number\" data-line-number=\"18\"></td>\n <td id=\"file-example-sh-LC18\" class=\"blob-code blob-code-inner js-file-line\">\n</td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L19\" class=\"blob-num js-line-number\" data-line-number=\"19\"></td>\n <td id=\"file-example-sh-LC19\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c\"><span class=\"pl-c\">#</span> redirects standard error to /dev/null (so no error)</span></td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L20\" class=\"blob-num js-line-number\" data-line-number=\"20\"></td>\n <td id=\"file-example-sh-LC20\" class=\"blob-code blob-code-inner js-file-line\">$ unlink unexisting-file.sh <span class=\"pl-k\">2&gt;</span> /dev/null</td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L21\" class=\"blob-num js-line-number\" data-line-number=\"21\"></td>\n <td id=\"file-example-sh-LC21\" class=\"blob-code blob-code-inner js-file-line\">\n</td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L22\" class=\"blob-num js-line-number\" data-line-number=\"22\"></td>\n <td id=\"file-example-sh-LC22\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c\"><span class=\"pl-c\">#</span> redirects everything to /dev/null (so no error)</span></td>\n </tr>\n <tr>\n <td id=\"file-example-sh-L23\" class=\"blob-num js-line-number\" data-line-number=\"23\"></td>\n <td id=\"file-example-sh-LC23\" class=\"blob-code blob-code-inner js-file-line\">$ unlink unexisting-file.sh <span class=\"pl-k\">&amp;</span><span class=\"pl-k\">&gt;</span> /dev/null</td>\n </tr>\n</table>\n\n\n </div>\n\n </div>\n</div>\n\n </div>\n <div class=\"gist-meta\">\n <a href=\"https://gist.github.com/weirdpattern/ce54fdb1e5621b5966e146026995b974/raw/83e7ad9d06525f3becfafb2f32ffa3122e8e846e/example.sh\" style=\"float:right\">view raw</a>\n <a href=\"https://gist.github.com/weirdpattern/ce54fdb1e5621b5966e146026995b974#file-example-sh\">example.sh</a>\n hosted with &#10084; by <a href=\"https://github.com\">GitHub</a>\n </div>\n </div>\n <div class=\"gist-file\">\n <div class=\"gist-data\">\n <div class=\"js-gist-file-update-container js-task-list-container file-box\">\n <div id=\"file-syntax-text\" class=\"file\">\n \n\n <div itemprop=\"text\" class=\"blob-wrapper data type-text\">\n <table class=\"highlight tab-size js-file-line-container\" data-tab-size=\"8\">\n <tr>\n <td id=\"file-syntax-text-L1\" class=\"blob-num js-line-number\" data-line-number=\"1\"></td>\n <td id=\"file-syntax-text-LC1\" class=\"blob-code blob-code-inner js-file-line\">&lt;operation&gt; [n]&gt; /dev/null [options]</td>\n </tr>\n</table>\n\n\n </div>\n\n </div>\n</div>\n\n </div>\n <div class=\"gist-meta\">\n <a href=\"https://gist.github.com/weirdpattern/ce54fdb1e5621b5966e146026995b974/raw/83e7ad9d06525f3becfafb2f32ffa3122e8e846e/syntax.text\" style=\"float:right\">view raw</a>\n <a href=\"https://gist.github.com/weirdpattern/ce54fdb1e5621b5966e146026995b974#file-syntax-text\">syntax.text</a>\n hosted with &#10084; by <a href=\"https://github.com\">GitHub</a>\n </div>\n </div>\n</div>\n",
8+
"stylesheet":"https://assets-cdn.github.com/assets/gist-embed-87673c31a5b37b5e6556b63e1081ebbc.css"
9+
}

specs/__mocks__/request-promise.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ export default url => {
99
"https://gist.github.com/weirdpattern/ce54fdb1e5621b5966e146026995b974.json?file=syntax.text"
1010
) {
1111
return JSON.stringify(require("./2.json"));
12+
} else if (
13+
url ===
14+
"https://gist.github.com/weirdpattern/ce54fdb1e5621b5966e146026995b974.json?file=example.sh"
15+
) {
16+
return JSON.stringify(require("./3.json"));
1217
}
1318
return false;
1419
};

0 commit comments

Comments
 (0)