Markdown to HTML: script compatible with WSH - Printable Version +- 0Day Forums (https://zeroday.vip) +-- Forum: Coding (https://zeroday.vip/Forum-Coding) +--- Forum: JScript (https://zeroday.vip/Forum-JScript) +--- Thread: Markdown to HTML: script compatible with WSH (/Thread-Markdown-to-HTML-script-compatible-with-WSH) |
Markdown to HTML: script compatible with WSH - holcomb310 - 07-24-2023 There's a Markdown-to-HTML converter at [Pagedown][1] project (JS script). My question is: how can I adapt this JS script to WSH (Windows Script Host) usage? I need e.g. js script which can be called by WSH command line: cscript.exe md_to_html.js c:\test\aa.md I didn't find such page in google. [1]: [To see links please register here] RE: Markdown to HTML: script compatible with WSH - alnooruefdxofbay - 07-24-2023 Create WSF-file named **pagedown.wsf** with the following script <!-- language: lang-html --> <job> <object id="Stream" progid="Adodb.Stream" /> <!-- utf-8 documents support --> <script language="jscript" src="Markdown.Converter.js" /> <script language="jscript"> Stream.Charset = 'utf-8'; Stream.Open(); Stream.LoadFromFile(WScript.Arguments.Item(0)); var text = Stream.ReadText(); WSH.Echo(new Markdown.Converter().makeHtml(text)) </script> </job> and use it with **cscript.exe** cscript //Nologo pagedown.wsf input.md > output.html In case of troubles with ADODB try to download and install it from [here][1]. [1]: [To see links please register here] |