Created
December 30, 2015 09:36
-
-
Save vvakame/9d90d7f0130c548ed285 to your computer and use it in GitHub Desktop.
サンプルコードを自動的にPlaygroundで試せるようにするリンク生成する方法思いついた
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| = クッソ捗る | |
| #@mapoutput(node tsToPlayground.js ./code/ts/letAndConst.ts) | |
| #@end | |
| で、@<code>{review-preproc -r article.re} とかやる。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| let fs = require("fs"); | |
| let content = fs.readFileSync(process.argv[2], {encoding:"utf8"}); | |
| let playgroundURL = `http://www.typescriptlang.org/Playground#src=${encodeURIComponent(content)}`; | |
| let GoogleURL = require("google-url"); | |
| new GoogleURL({key: "API Key"}).shorten(playgroundURL, (err, shortURL) => { | |
| if (err) { | |
| process.exit(1); | |
| return; | |
| } | |
| console.log(`@<href>{${shortURL},Playgroundで試す}`); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment