Skip to content

Commit

Permalink
update (typicode#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode authored Aug 5, 2019
1 parent 5fbf5ef commit 13f09a7
Show file tree
Hide file tree
Showing 10 changed files with 3,114 additions and 324 deletions.
4 changes: 4 additions & 0 deletions .github/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Convert to markdown
// use layout to
// create index.html
// create guide.html
27 changes: 27 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const path = require("path");
const fs = require("fs");
const showdown = require("showdown");
const pupa = require("pupa");

function readFile(filename) {
return fs.readFileSync(path.join(__dirname, "templates", filename), "utf-8");
}

function render(filename, content) {
fs.writeFileSync(
path.join(__dirname, "public", filename),
pupa(layout, { content })
);
}

const layout = readFile("layout.html");
const index = readFile("index.html");

const converter = new showdown.Converter({ simplifiedAutoLink: true });
const guideMarkdown = readFile("GUIDE.md");
// const headingRegexp = /^## (.*)$/gm;
// console.log("res", text.match(headingRegexp));
const guide = converter.makeHtml(guideMarkdown);

render("index.html", index);
render("guide.html", guide);
Loading

0 comments on commit 13f09a7

Please sign in to comment.