diff --git a/help.ts b/help.ts index 293ea95..c578e2e 100644 --- a/help.ts +++ b/help.ts @@ -1,5 +1,5 @@ export default ` -makudaun v0.1.0 - simple md to html +makudaun v0.2.0 - simple md to html makudaun ARG1 - input markdown file (required) diff --git a/justfile b/justfile index 9234ee1..5437b28 100755 --- a/justfile +++ b/justfile @@ -1,7 +1,7 @@ #!/usr/bin/env just --justfile dev: - deno run --allow-read --allow-write ./mod.ts + deno run --allow-read --allow-write ./mod.ts readme.md cache: deno cache ./mod.ts diff --git a/mod.ts b/mod.ts index cd79055..3af4e73 100644 --- a/mod.ts +++ b/mod.ts @@ -1,6 +1,6 @@ import help from "./help.ts"; import styles from "./styles.ts"; -import showdown from "https://esm.sh/showdown@1.9.0"; +import showdown from "https://esm.sh/showdown@2.1.0"; const input = Deno.args[0]; const output = Deno.args[1] || "index.html"; @@ -20,11 +20,14 @@ const markdown = await Deno.readTextFile(input).catch(() => { // Converter from md to html const converter = new showdown.Converter({ ghCompatibleHeaderId: true, - simpleLineBreaks: true, + openLinksInNewWindow: true, ghMentions: true, tables: true, }); +// Use GitHub's Flavor +showdown.setFlavor('github'); + // Post beginning of HTML file const preContent = ` @@ -45,7 +48,11 @@ const postContent = ` `; // converter.setFlavor("github"); +// Complete const html = preContent.trim() + converter.makeHtml(markdown) + postContent.trim(); +// Partial +// const html = converter.makeHtml(markdown); + // Write converted output to file await Deno.writeTextFile(output, html); diff --git a/readme.md b/readme.md index 0d28b77..c9539e6 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ deno compile --allow-all --allow-write ./mod.ts ## Installing ```shell -deno install https://deno.land/x/makudaun@0.1.0/mod.ts +deno install https://deno.land/x/makudaun@0.2.0/mod.ts ``` ## Usage