diff --git a/db.js b/db.js index e68c2e9..18b04a2 100644 --- a/db.js +++ b/db.js @@ -1,10 +1,18 @@ var FS = require('fs'); var Path = require('path'); -var Markdown = require('markdown').markdown; +var Markdown = require("marked"); var knex = require("knex"); var Bookshelf = require('bookshelf'); + +Markdown.setOptions({ + renderer: new Markdown.Renderer(), + gfm: true, + tables: true, + sanitize: true + +}) // This function is used to map wiki page names to files // on the real filesystem. function pathFromName(name) { @@ -31,7 +39,7 @@ exports.loadPage = function (name, callback) { } // Parse and render the markdown. - var tree = Markdown.parse(markdown); + /*var tree = Markdown.parse(markdown); var title = name; for (var i = 1, l = tree.length; i < l; i++) { if (tree[i] && tree[i][0] === "header") { @@ -39,12 +47,12 @@ exports.loadPage = function (name, callback) { tree.splice(i, 1); break; } - } - var html = Markdown.toHTML(tree); + }*/ + var html = Markdown(markdown); callback(null, { name: name, - title: title, + title: null, exists: exists, markdown: markdown, html: html, diff --git a/package.json b/package.json index db509d9..f2b97e7 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "jade": ">= 0.0.1", "knex": "^0.7.6", "markdown": "~0.3.1", + "marked": "^0.3.3", "passport-local": "^1.0.0", "trycatch": "~0.0.9" } diff --git a/pages/home.markdown b/pages/home.markdown index 1ed6ed2..d0a9aaa 100644 --- a/pages/home.markdown +++ b/pages/home.markdown @@ -1,4 +1,6 @@ ###Hello THSF -this is a simple wiki :) +this is a simple and stupid wiki :) -![](http://stuffpoint.com/lol-cats/image/29077-lol-cats-magical-kitteh.png) \ No newline at end of file +![](http://stuffpoint.com/lol-cats/image/29077-lol-cats-magical-kitteh.png) + + \ No newline at end of file diff --git a/pages/zoor.markdown b/pages/zoor.markdown new file mode 100644 index 0000000..0f179d0 --- /dev/null +++ b/pages/zoor.markdown @@ -0,0 +1,7 @@ +# zoor + +| Tables | Are | Cool | +| ------------- |:-------------:| -----:| +| col 3 is | right-aligned | $1600 | +| col 2 is | centered | $12 | +| zebra stripes | are neat | $1 | \ No newline at end of file diff --git a/views/.layout.jade.swp b/views/.layout.jade.swp new file mode 100644 index 0000000..9dc4fc7 Binary files /dev/null and b/views/.layout.jade.swp differ diff --git a/views/edit.jade b/views/edit.jade index 010a1a9..6a17d1a 100644 --- a/views/edit.jade +++ b/views/edit.jade @@ -1,4 +1,5 @@ +include ./layout.jade h1= title form(method="post", action="/" + name) textarea(name="markdown")= markdown - input(type="submit") \ No newline at end of file + input(type="submit") diff --git a/views/layout.jade b/views/layout.jade index 1a36941..329acbb 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -1,6 +1,6 @@ -!!! +doctype html html head title= title link(rel='stylesheet', href='/stylesheets/style.css') - body!= body \ No newline at end of file + body!= body diff --git a/views/view.jade b/views/view.jade index 5fb0ed6..e6018de 100644 --- a/views/view.jade +++ b/views/view.jade @@ -1,3 +1,4 @@ +include ./layout.jade h1= title .article!= html -a(href="/" + name + "/edit")= "Edit this Page" \ No newline at end of file +a(href="/" + name + "/edit")= "Edit this Page"