miki

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

commit 0b74c71aa7b7decfd699a6d451f9a3be31eb94d6
parent 6e945c35e16dd20048abb51137ca30aff2f36ff1
Author: weetat <wtenison@protonmail.com>
Date:   Fri, 25 Apr 2025 17:36:24 +0000

Update fmd.wasm and reformat editor content

Rebuild fmd.wasm and spread the editor's default and legend fmd over
multiple lines. Apply the saved theme without waiting for onload,
default to dark, and give the manifest an id.

Diffstat:
Mweb/edit/default.fmd | 16+++++++++++-----
Mweb/edit/legend.fmd | 21++++++++++++++-------
Mweb/global/fmd.wasm | 0
Mweb/global/manifest.json | 3++-
Mweb/global/script.js | 26++++++++++++--------------
Mweb/global/styles.css | 3+--
Mweb/home/info.fmd | 7+++++--
Mweb/subject/script.js | 1+
Mweb/sw.js | 2+-
9 files changed, 47 insertions(+), 32 deletions(-)

diff --git a/web/edit/default.fmd b/web/edit/default.fmd @@ -1,5 +1,7 @@ -_(class:"--hide"):{Click on the 'Render' button to see rendered the HTML output of this text} h1:{- Welcome -} +_(class:"--hide"):{Click on the 'Render' button to see rendered the HTML output of this text} +h1:{- Welcome -} _(class:"--set-size_5-4-font"):{OVERVIEW} + sup:{This is a info page for the b:{FMD interpreter}.} The b:{FMD interpreter} is being developed for the a(link:"https://test.wtenison.com/home"):{Miki Project} to provide a convenient Markdown language that is easy to parse, straightforward to read, and able to work with HTML. This is a application being developed for education and personal use. FMD runs on the browser via a WASM module. @@ -7,9 +9,13 @@ Using the b:{Text Pad} sup:{(click b:RETURN above if in b:OUTPUT view)}, you may FMD uses a simple expression form to execute operations: code:{OPERATOR-ID:OPERAND} or code:{OPERATOR-ID(PARAMS optional):OPERAND} For the purposes of this demonstration, I won't touch on the code:{PARAMS} much here (i:{for now}). They don't do much for most operations that needs to be known right now. -col:{ _:{sup:i:{Examples:}} _:{ code:{ "i:car" } = code:{i:car} sm:{for single word operation.} - code:{"b:{golden retriever lab}" } = code:{b:{golden retriever lab}} sm:{for operations on multiple words.} - code:{"p:{test sentence}"} = code:{"p():{test sentence}" } sm:{when empty code:{()} are optional.} - }} +col:{ + _:{sup:i:{Examples:}} + _:{ + code:{ "i:car" } = code:{i:car} sm:{for single word operation.} + code:{"b:{golden retriever lab}" } = code:{b:{golden retriever lab}} sm:{for operations on multiple words.} + code:{"p:{test sentence}"} = code:{"p():{test sentence}" } sm:{when empty code:{()} are optional.} + } +} i:{Click on b:Guide button bellow for list of operators and more.} \ No newline at end of file diff --git a/web/edit/legend.fmd b/web/edit/legend.fmd @@ -1,18 +1,25 @@ _(class:"--set-size_5-4-font"):{OVERVIEW} + sup:{This is a info page for the b:{FMD interpreter}.} The b:{FMD interpreter} is being developed for the a(link:"https://test.wtenison.com/home"):{Miki Project} to provide a convenient Markdown language that is easy to parse, straightforward to read, and able to work with HTML. This is a application being developed for education and personal use. FMD runs on the browser via a WASM module. -Using the b:{Text Pad} sup:{(click b:RETURN above if in b:OUTPUT view)}, you may input almost any character without stirring the ire of the interpreter. The symbols you need to look out are: code:{ : "{ }" ( ) } +Using the b:{Text Pad} sup:{(click b:RETURN above if in b:OUTPUT view)}, you may input almost any character without stirring the ire of the interpreter. The symbols you need to look out are: code:{ : "{ }" ( )} FMD uses a simple expression form to execute operations: code:{OPERATOR-ID:OPERAND} or code:{OPERATOR-ID(PARAMS optional):OPERAND} For the purposes of this demonstration, I won't touch on the code:{PARAMS} much here (i:{for now}). They don't do much for most operations that needs to be known right now. -col:{ _:{sup:i:{Examples:}} _:{ code:{ "i:car" } = code:{i:car} sm:{for single word operation.} - code:{"b:{golden retriever lab}" } = code:{b:{golden retriever lab}} sm:{for operations on multiple words.} - code:{"p:{test sentence}"} = code:{"p():{test sentence}" } sm:{when empty code:{()} are optional.} - - i:sm:{See default b:{Text Pad} content for use example. Refresh page if cleared.}}} +col:{ + _:{sup:i:{Examples:}} + _:{ + code:{ "i:car" } = code:{i:car} sm:{for single word operation.} + code:{"b:{golden retriever lab}" } = code:{b:{golden retriever lab}} sm:{for operations on multiple words.} + code:{"p:{test sentence}"} = code:{"p():{test sentence}" } sm:{when empty code:{()} are optional.} + + i:sm:{See default b:{Text Pad} content for use example. Refresh page if cleared.} + } +} + +_(class:"--set-size_5-4-font"):OPERATORS -_(class:"--set-size_5-4-font"):{OPERATORS} code:{_} : b:{Empty} - Creates an empty code:{div}. code:{p} : b:{Paragraph} code:{b} : b:{Bold} diff --git a/web/global/fmd.wasm b/web/global/fmd.wasm Binary files differ. diff --git a/web/global/manifest.json b/web/global/manifest.json @@ -1,4 +1,5 @@ { + "id": "miki", "name": "My Wiki", "short_name": "Miki", "description": "A personal wiki and note taking application.", @@ -6,7 +7,7 @@ "display": "standalone", "orientation": "any", - "form_factor": "wide", + "form_factor": "any", "theme_color": "#ff7675", "background_color": "#2d3436", "icons": [ diff --git a/web/global/script.js b/web/global/script.js @@ -1,28 +1,26 @@ -// GLOBAL SETTINGS +// GLOBAL SETTINGS // if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js') - .then(registration => { - console.log('> Service Worker registered with scope:', registration.scope); - }) - .catch(error => { - console.error('> Service Worker registration failed:', error); - }) + .then(registration => { + console.log('> Service Worker registered with scope:', registration.scope); + }) + .catch(error => { + console.error('> Service Worker registration failed:', error); + }) } else { console.error('> Service Worker is not supported by this browser.'); } -window.onload = () => { - if (sessionStorage.getItem("theme") != null) { - document.body.style.colorScheme = sessionStorage.getItem("theme") - } +if (sessionStorage.getItem("theme") != null) { + document.body.style.colorScheme = sessionStorage.getItem("theme") } // COLLAPSIBLE // -_collapsibleToggles = document.getElementsByClassName("_collapsible-toggle_") +_collapsibleToggles = document.getElementsByClassName('_collapsible-toggle_') for (let i = 0; i < _collapsibleToggles.length; i++) { _collapsibleToggles[i].addEventListener("click", function () { _collapsibleToggles[i].classList.toggle("--open") @@ -39,8 +37,8 @@ for (let i = 0; i < _collapsibleToggles.length; i++) { // SWAP THEME // document.getElementById("swap-theme-bttn").onclick = (event) => { - document.body.style.colorScheme = + document.body.style.colorScheme = (document.body.style.colorScheme == "light" || - document.body.style.colorScheme == "") ? "dark" : "light" + document.body.style.colorScheme == "") ? "dark" : "light" sessionStorage.setItem("theme", document.body.style.colorScheme) } \ No newline at end of file diff --git a/web/global/styles.css b/web/global/styles.css @@ -88,10 +88,9 @@ body { position: relative; - height: 100%; margin: var(--fmd_margin); - color-scheme: light; + color-scheme: dark; color: var(--fmd_color__font-d); background-color: var(--fmd_color__bg-l); diff --git a/web/home/info.fmd b/web/home/info.fmd @@ -1,6 +1,9 @@ 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}). +_(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. diff --git a/web/subject/script.js b/web/subject/script.js @@ -17,6 +17,7 @@ WebAssembly.instantiateStreaming(fetch("web/global/fmd.wasm"), go.importObject) if (_subject != "") { _res = await loadFMDFileHTML("https://test.wtenison.com/web/subject/" + _subject + ".fmd", _subjectContent) + if (_res == "valid") _pageSubjectTitle.innerHTML = _subject else diff --git a/web/sw.js b/web/sw.js @@ -12,7 +12,7 @@ self.addEventListener("install", (event) => { "/global/script.js", "/global/fmd.wasm", "/global/wasm_exec.js", - ]).catch(err => console.error("Failed to cache files: ", err)) + ]).catch(err => console.error("> Failed to cache files: ", err)) }) ); });