converts a code snippet to md table embeddable <pre> one-liner
$ npm install -g 2pre
$ 2pre --help
USAGE
$ 2pre FILE
ARGUMENTS
FILE file to convert
OPTIONS
-h, --help show CLI help
-t, --tabsize=tabsize [default: 2] tab size
-v, --version show CLI version
$ 2pre ./test/test.js
async run() {
const { args } = this.parse(_2Pre);
if (!existsSync(args.file)) {
throw new Error("Please provide valid file path");
}
const code = readFileSync(args.file).toString();
this.log(code);
const converted = _2Pre.convertCode(code);
this.log(converted);
}
<pre> async run() {<br/> const { args } = this.parse(_2Pre);<br/> if (!existsSync(args.file)) {<br/> throw new Error("Please provide valid file path");<br/> }<br/> const code = readFileSync(args.file).toString();<br/> this.log(code);<br/> const converted = _2Pre.convertCode(code);<br/> this.log(converted);<br/> }<br/></pre>