mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 01:50:07 +00:00
more experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
17a159f310
commit
62b4f86492
@ -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...
|
||||
|
||||
|
||||
12
pwiki2.html
12
pwiki2.html
@ -23,6 +23,16 @@
|
||||
<link rel="stylesheet" href="css/fonts.css">
|
||||
|
||||
|
||||
<!-- NativeMarkdown -->
|
||||
<script src="ext-lib/showdown.min.js"></script>
|
||||
<script>
|
||||
var MarkdownPage = {
|
||||
}
|
||||
</script>
|
||||
<!-- NativeMarkdown -->
|
||||
|
||||
|
||||
|
||||
<!-- MediumEditor -->
|
||||
<!--link rel="stylesheet" href="experiments/medium-editor/css/medium-editor.css">
|
||||
<link rel="stylesheet" href="experiments/medium-editor/css/themes/default.css">
|
||||
@ -44,7 +54,7 @@ var setupMediumEditor = async function () {
|
||||
editor = new MediumEditor(editorelem, {
|
||||
extensions: {
|
||||
markdown: new MeMarkdown(function(code) {
|
||||
saveContent(page.path, code)
|
||||
saveLiveContent(page.path, code)
|
||||
// XXX DEBUG...
|
||||
elem
|
||||
&& (elem.textContent = code) }) } }) } }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user