miki

Miki: personal wiki with the fmd markup format
git clone https://wtenison.com/repo/miki.git
Log | Files | Refs | README | LICENSE

commit 1975cb4f9188c482aa1ea5f362181bfb81e641df
parent b1ab631f06a65218fe491e32db0ace97c278871b
Author: weetat <wtenison@protonmail.com>
Date:   Tue, 15 Apr 2025 22:04:14 +0000

Keep fmd pages next to their views

Home and subject content now loads from web/home/info.fmd and
web/subject/*.fmd instead of /data/fmd. Rename the templates to
tmpl.*.html, fix the fmd.wasm path in the editor, and give the editor
its own FMD state.

Diffstat:
Mweb/edit/script.js | 16++++++++--------
Rweb/global/fmd.tmpl.html -> web/global/tmpl.fmd.html | 0
Rweb/global/header.tmpl.html -> web/global/tmpl.header.html | 0
Rweb/global/meta.tmpl.html -> web/global/tmpl.meta.html | 0
Dweb/home/home.fmd | 8--------
Aweb/home/info.fmd | 8++++++++
Mweb/home/script.js | 2+-
Mweb/subject/script.js | 3++-
8 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/web/edit/script.js b/web/edit/script.js @@ -8,16 +8,16 @@ const go = new global.Go(); -WebAssembly.instantiateStreaming(fetch("web/global/fmd/fmd.wasm"), go.importObject) +WebAssembly.instantiateStreaming(fetch("web/global/fmd.wasm"), go.importObject) .then((result) => { go.run(result.instance); - makeFMDState(0) + makeFMDState(0) // System state + makeFMDState(1) // Editor state - fmdViewDescriptor.innerHTML = interpretFMD(0, "span(class:\"__descriptor\"):{b:{TEXT PAD}<br>span:{Input fmd text here ▾}}") + fmdViewDescriptor.innerHTML = interpretFMD(1, "span(class:\"__descriptor\"):{b:{TEXT PAD}<br>span:{Input fmd text here ▾}}") loadFMDFileRaw("https://test.wtenison.com/web/edit/default.fmd", fmdViewPanelSet["text-editor"].content) - loadFMDFileHTML("https://test.wtenison.com/web/edit/legend.fmd", fmdViewPanelSet["guide-text"].content) }) .catch(err => console.error('_ERROR:instantiateStreaming:failed to load WASM:', err)); @@ -51,15 +51,15 @@ var fmdViewPanelSet = { var fmdViewTransitions = { "text-editor": { open: function () { - fmdViewDescriptor.innerHTML = interpretFMD("span(class:\"__descriptor\"):{b:{TEXT PAD}<br>span:{Input fmd text here ▾}}") + fmdViewDescriptor.innerHTML = interpretFMD(1, "span(class:\"__descriptor\"):{b:{TEXT PAD}<br>span:{Input fmd text here ▾}}") }, close: function () { return } }, "html-output": { open: function () { - fmdViewDescriptor.innerHTML = interpretFMD("span(class:\"__descriptor\"):{b:{OUTPUT}<br>span:{View rendered text:}}") + fmdViewDescriptor.innerHTML = interpretFMD(1, "span(class:\"__descriptor\"):{b:{OUTPUT}<br>span:{View rendered text:}}") fmdViewPanelSet["html-output"].root.classList.add("--open") - fmdViewPanelSet["html-output"].content.innerHTML = interpretFMD(fmdViewPanelSet["text-editor"].content.value) + fmdViewPanelSet["html-output"].content.innerHTML = interpretFMD(1, fmdViewPanelSet["text-editor"].content.value) renderButton = document.getElementById("render-fmd-bttn") renderButton.innerHTML = "◂ RETURN" }, @@ -71,7 +71,7 @@ var fmdViewTransitions = { }, "guide-text": { open: function () { - fmdViewDescriptor.innerHTML = interpretFMD("span(class:\"__descriptor\"):{b:{GUIDE}<br>span:{Readme:}}") + fmdViewDescriptor.innerHTML = interpretFMD(1, "span(class:\"__descriptor\"):{b:{GUIDE}<br>span:{Readme:}}") fmdViewPanelSet["guide-text"].root.classList.add("--open") openGuideButton = document.getElementById("open-guide-bttn") openGuideButton.innerHTML = "CLOSE ▸" diff --git a/web/global/fmd.tmpl.html b/web/global/tmpl.fmd.html diff --git a/web/global/header.tmpl.html b/web/global/tmpl.header.html diff --git a/web/global/meta.tmpl.html b/web/global/tmpl.meta.html diff --git a/web/home/home.fmd b/web/home/home.fmd @@ -1,7 +0,0 @@ -h1:{Welcome} -_(id:"subcard"):{This is a subcard -} Miki is a personal documentation application in development with the intent of providing a standard interface for creating, organizing, and viewing wiki like articles generated by the user. The repo for this project exists a(link:"https://codeberg.org/wtenison/miki"):here (i:{Codeberg.org}). - -The project is a work in progress; polish and precision takes care and time. The current point of order is completing an functional editor interface for the markdown language (my own FMD). The current version of the editor can be viewed a(link:"https://miki.wtenison.com/edit"):here. - -i:{Example article:} a(link:"https://miki.wtenison.com/subject?s=test"):{Test page} -\ No newline at end of file diff --git a/web/home/info.fmd b/web/home/info.fmd @@ -0,0 +1,7 @@ +h1:{Welcome} +_(id:"subcard"):{This is a subcard +} Miki is a personal documentation application in development with the intent of providing a standard interface for creating, organizing, and viewing wiki like articles generated by the user. The repo for this project exists a(link:"https://codeberg.org/wtenison/miki"):here (i:{Codeberg.org}). + +The project is a work in progress; polish and precision takes care and time. The current point of order is completing an functional editor interface for the markdown language (my own FMD). The current version of the editor can be viewed a(link:"https://test.wtenison.com/edit"):here. + +i:{Example article:} a(link:"https://test.wtenison.com/subject?s=test"):{Test page} +\ No newline at end of file diff --git a/web/home/script.js b/web/home/script.js @@ -9,7 +9,7 @@ WebAssembly.instantiateStreaming(fetch("web/global/fmd.wasm"), go.importObject) _homePageContent = document.getElementById("home-page-view").getElementsByClassName("_content_")[0] - loadFMDFileHTML("https://test.wtenison.com/data/fmd/home.fmd", _homePageContent) + loadFMDFileHTML("https://test.wtenison.com/web/home/info.fmd", _homePageContent) }) .catch(err => console.error('_ERROR:instantiateStreaming:failed to load WASM:', err)); \ No newline at end of file diff --git a/web/subject/script.js b/web/subject/script.js @@ -15,12 +15,13 @@ WebAssembly.instantiateStreaming(fetch("web/global/fmd.wasm"), go.importObject) _urlParams = new URLSearchParams(window.location.search); const _subject = _urlParams.get("s"); + if (_subject == "") { _pageSubjectTitle.innerHTML = "N/A" _subjectContent.innerHTML = "No subject specified" } else { _pageSubjectTitle.innerHTML = "<b>" + _subject + "</b>" - loadFMDFileHTML("https://test.wtenison.com/data/fmd/" + _subject + ".fmd", _subjectContent) + loadFMDFileHTML("https://test.wtenison.com/web/subject/" + _subject + ".fmd", _subjectContent) } }) .catch(err => console.error('_ERROR:instantiateStreaming:failed to load WASM:', err)); \ No newline at end of file