Skip to content

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Aug 10, 2022
1 parent a41054f commit e86e973
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion help.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default `
makudaun v0.1.0 - simple md to html
makudaun v0.2.0 - simple md to html
makudaun <ARG1> <ARG2>
ARG1 - input markdown file (required)
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 9 additions & 2 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 = `
<html lang="en">
Expand All @@ -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);
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e86e973

Please sign in to comment.