diff --git a/pwiki/page.js b/pwiki/page.js index 2c81258..0d1020c 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -1594,6 +1594,33 @@ object.Constructor('Page', BasePage, { +//--------------------------------------------------------------------- +// Markdown renderer... +// XXX EXPERIMENTAL... + +var showdown = require('showdown') + +var MarkdownPage = +module.MarkdownPage = +object.Constructor('MarkdownPage', Page, { + actions: { + ...module.Page.prototype.actions, + + html: true, + }, + + markdown: new showdown.Converter(), + + get html(){ return async function(){ + return this.markdown.makeHtml(await this.raw) }.call(this) }, + set html(value){ + this.raw = this.markdown.makeMarkdown(value) }, +}) + +// XXX HACK... +var Page = MarkdownPage + + //--------------------------------------------------------------------- // Cached .text page... diff --git a/pwiki2.html b/pwiki2.html index ea7116a..a5338f9 100755 --- a/pwiki2.html +++ b/pwiki2.html @@ -23,6 +23,16 @@ + + + + + + +