diff --git a/docs/generate.js b/docs/generate.js index 438b8343..52bc3e70 100644 --- a/docs/generate.js +++ b/docs/generate.js @@ -8,13 +8,9 @@ var version = JSON.parse(fs.readFileSync("./package.json", "utf-8")).version try {fs.mkdirSync("./dist")} catch (e) {/* ignore */} try {fs.mkdirSync("./dist/archive")} catch (e) {/* ignore */} try {fs.mkdirSync("./dist/archive/v" + version)} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/archive/v" + version + "/lib")} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/archive/v" + version + "/lib/prism")} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/lib")} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/lib/prism")} catch (e) {/* ignore */} -var guides = fs.readFileSync("docs/guides.md", "utf-8") -var methods = fs.readFileSync("docs/methods.md", "utf-8") +var guides = fs.readFileSync("docs/nav-guides.md", "utf-8") +var methods = fs.readFileSync("docs/nav-methods.md", "utf-8") var index = fs.readFileSync("docs/index.md", "utf-8") fs.writeFileSync("README.md", index.replace(/(\]\()(.+?)\.md(\))/g, "$1http://mithril.js.org/$2.html$3"), "utf-8") @@ -27,7 +23,7 @@ function generate(pathname) { generate(pathname + "/" + filename) }) } - else if (!pathname.match(/tutorials|archive|guides|methods/)) { + else if (!pathname.match(/tutorials|archive|nav-/)) { if (pathname.match(/\.md$/)) { var outputFilename = pathname.replace(/\.md$/, ".html") var markdown = fs.readFileSync(pathname, "utf-8") @@ -55,7 +51,9 @@ function generate(pathname) { .replace(/\[version\]/, version) // update version .replace(/\[body\]/, markedHtml) .replace(/(.+?)<\/h.>/gim, function(match, n, id, text) { // fix anchors - return ".+?<\/a>/g, "").replace(/\.|\[|\]|"|\/|\(|\)/g, "").replace(/\s/g, "-") + '">' + text + "" + var anchor = text.toLowerCase().replace(/<(\/?)code>/g, "").replace(/.+?<\/a>/g, "").replace(/\.|\[|\]|"|\/|\(|\)/g, "").replace(/\s/g, "-"); + + return `${text}`; }) fs.writeFileSync("./dist/archive/v" + version + "/" + outputFilename.replace(/^docs\//, ""), html, "utf-8") fs.writeFileSync("./dist/" + outputFilename.replace(/^docs\//, ""), html, "utf-8") diff --git a/docs/index.md b/docs/index.md index 1481b21e..86aca2cc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,7 +12,7 @@ ### What is Mithril? -Mithril is a modern client-side Javascript framework for building Single Page Applications. +Mithril is a modern client-side Javascript framework for building Single Page Applications. It's small (< 8kb gzip), fast and provides routing and XHR utilities out of the box.
@@ -69,7 +69,7 @@ Let's create an HTML file to follow along: ### Hello world -Let's start as small as well can: render some text on screen. Copy the code below into your file (and by copy, I mean type it out - you'll learn better) +Let's start as small as we can: render some text on screen. Copy the code below into your file (and by copy, I mean type it out - you'll learn better) ```javascript var root = document.body diff --git a/docs/layout.html b/docs/layout.html index 9dac0d2d..f5ce0231 100644 --- a/docs/layout.html +++ b/docs/layout.html @@ -2,8 +2,7 @@ Mithril.js - - + @@ -27,7 +26,8 @@ License: MIT. © Leo Horie. - + +