#!/usr/bin/env node var showdown,fs=require("fs"),json=JSON.parse(fs.readFileSync("package.json","utf8")),version=json.version,Command=require("commander").Command,program=new Command;function Messenger(o,t,n){"use strict";t=!!t||!!n,n=!!n,this._print="stdout"===(o=o||"stderr")?console.log:console.error,this.errorExit=function(o){n||(console.error("ERROR: "+o.message),console.error("Run 'showdown -h' for help")),process.exit(1)},this.okExit=function(){n||(this._print("\n"),this._print("DONE!")),process.exit(0)},this.printMsg=function(o){t||n||!o||this._print(o)},this.printError=function(o){n||console.error(o)}}function showShowdownOptions(){"use strict";var o,t=showdown.getDefaultOptions(!1);for(o in console.log("\nshowdown makehtml config options:"),t)t.hasOwnProperty(o)&&console.log(" "+o+":","[default="+t[o].defaultValue+"]",t[o].describe);console.log('\n\nExample: showdown makehtml -c openLinksInNewWindow ghMentions ghMentionsLink="https://google.com"')}function parseShowdownOptions(o,t){"use strict";var n=t;if(o)for(var e=0;e [options]").option("-q, --quiet","Quiet mode. Only print errors").option("-m, --mute","Mute mode. Does not print anything"),program.command("makehtml").description("Converts markdown into html").addHelpText("after","\n\nExamples:").addHelpText("after"," showdown makehtml -i Reads from stdin and outputs to stdout").addHelpText("after"," showdown makehtml -i foo.md -o bar.html Reads 'foo.md' and writes to 'bar.html'").addHelpText("after",' showdown makehtml -i --flavor="github" Parses stdin using GFM style').addHelpText("after","\nNote for windows users:").addHelpText("after","When reading from stdin, use option -u to set the proper encoding or run `chcp 65001` prior to calling showdown cli to set the command line to utf-8").option("-i, --input [file]","Input source. Usually a md file. If omitted or empty, reads from stdin. Windows users see note below.",!0).option("-o, --output [file]","Output target. Usually a html file. If omitted or empty, writes to stdout",!0).option("-u, --encoding ","Sets the input encoding","utf8").option("-y, --output-encoding ","Sets the output encoding","utf8").option("-a, --append","Append data to output instead of overwriting. Ignored if writing to stdout",!1).option("-e, --extensions ","Load the specified extensions. Should be valid paths to node compatible extensions").option("-p, --flavor ","Run with a predetermined flavor of options. Default is vanilla","vanilla").option("-c, --config ","Enables showdown makehtml parser config options. Overrides flavor").option("--config-help","Shows configuration options for showdown parser").action(makehtmlCommand),program.parse();