more experimenting...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-10-06 22:48:09 +03:00
parent 17a159f310
commit 62b4f86492
2 changed files with 38 additions and 1 deletions

View File

@ -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... // Cached .text page...

View File

@ -23,6 +23,16 @@
<link rel="stylesheet" href="css/fonts.css"> <link rel="stylesheet" href="css/fonts.css">
<!-- NativeMarkdown -->
<script src="ext-lib/showdown.min.js"></script>
<script>
var MarkdownPage = {
}
</script>
<!-- NativeMarkdown -->
<!-- MediumEditor --> <!-- MediumEditor -->
<!--link rel="stylesheet" href="experiments/medium-editor/css/medium-editor.css"> <!--link rel="stylesheet" href="experiments/medium-editor/css/medium-editor.css">
<link rel="stylesheet" href="experiments/medium-editor/css/themes/default.css"> <link rel="stylesheet" href="experiments/medium-editor/css/themes/default.css">
@ -44,7 +54,7 @@ var setupMediumEditor = async function () {
editor = new MediumEditor(editorelem, { editor = new MediumEditor(editorelem, {
extensions: { extensions: {
markdown: new MeMarkdown(function(code) { markdown: new MeMarkdown(function(code) {
saveContent(page.path, code) saveLiveContent(page.path, code)
// XXX DEBUG... // XXX DEBUG...
elem elem
&& (elem.textContent = code) }) } }) } } && (elem.textContent = code) }) } }) } }