added code blocks + notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-10-12 22:56:12 +03:00
parent 9494439f77
commit ad2df7c676
3 changed files with 41 additions and 27 deletions

View File

@ -450,12 +450,17 @@ editor .outline .block:focus {
/* code... */ /* code... */
.editor .outline .block>.view pre,
.editor .outline .block>.view code { .editor .outline .block>.view code {
padding: 0.1em 0.3em; padding: 0.1em 0.3em;
font-family: monospace; font-family: monospace;
background: rgba(0,0,0,0.07); background: rgba(0,0,0,0.07);
border-radius: 0.2em; border-radius: 0.2em;
} }
.editor .outline .block>.view pre {
padding: 1em 1em;
padding-bottom: 1.5em;
}
/* Tables... */ /* Tables... */

View File

@ -327,18 +327,22 @@ var Outline = {
elem.style.push(...style) elem.style.push(...style)
return code return code
?? text } } ?? text } }
var quote = function(_, code){ var quoteText = function(text){
code = code return text
.replace(/(?<!\\)&/g, '&amp;') .replace(/(?<!\\)&/g, '&amp;')
.replace(/(?<!\\)</g, '&lt;') .replace(/(?<!\\)</g, '&lt;')
.replace(/(?<!\\)>/g, '&gt;') .replace(/(?<!\\)>/g, '&gt;')
.replace(/\\(?!`)/g, '\\\\') .replace(/\\(?!`)/g, '\\\\') }
return `<code>${code}</code>` } var quote = function(_, code){
return `<code>${quoteText(code)}</code>` }
var pre = function(_, code){
return `<pre>${ quoteText(code) }</pre>` }
var table = function(_, body){ var table = function(_, body){
body = body return `<table><tr><td>${
.replace(/\s*\|\s*\n\s*\|\s*/gm, '</td></tr>\n<tr><td>') body
.replace(/\s*\|\s*/gm, '</td><td>') .replace(/\s*\|\s*\n\s*\|\s*/gm, '</td></tr>\n<tr><td>')
return `<table><tr><td>${body}</td></td></table>` } .replace(/\s*\|\s*/gm, '</td><td>')
}</td></td></table>` }
elem.text = code elem.text = code
// hidden attributes... // hidden attributes...
// XXX make this generic... // XXX make this generic...
@ -394,6 +398,8 @@ var Outline = {
.replace(/(?<!\\)\*(?=[^\s*])(([^*]|\\\*)*[^\s*])(?<!\\)\*/gm, '<b>$1</b>') .replace(/(?<!\\)\*(?=[^\s*])(([^*]|\\\*)*[^\s*])(?<!\\)\*/gm, '<b>$1</b>')
.replace(/(?<!\\)~(?=[^\s~])(([^~]|\\~)*[^\s~])(?<!\\)~/gm, '<s>$1</s>') .replace(/(?<!\\)~(?=[^\s~])(([^~]|\\~)*[^\s~])(?<!\\)~/gm, '<s>$1</s>')
.replace(/(?<!\\)_(?=[^\s_])(([^_]|\\_)*[^\s_])(?<!\\)_/gm, '<i>$1</i>') .replace(/(?<!\\)_(?=[^\s_])(([^_]|\\_)*[^\s_])(?<!\\)_/gm, '<i>$1</i>')
// code/quoting...
.replace(/(?<!\\)```\s*\n((\n|.)*)\h*(?<!\\)```\s*/g, pre)
.replace(/(?<!\\)`(?=[^\s])(([^`]|\\`)*[^\s])(?<!\\)`/gm, quote) .replace(/(?<!\\)`(?=[^\s])(([^`]|\\`)*[^\s])(?<!\\)`/gm, quote)
// XXX support "\==" in mark... // XXX support "\==" in mark...
.replace(/(?<!\\)==(?=[^\s])(.*[^\s])(?<!\\)==/gm, '<mark>$1</mark>') .replace(/(?<!\\)==(?=[^\s])(.*[^\s])(?<!\\)==/gm, '<mark>$1</mark>')

View File

@ -36,6 +36,7 @@ var setup = function(){
- Bonsai - Bonsai
- -
- ## Bugs: - ## Bugs:
- BUG: ASAP: editor: `-` at start of line is interpreted as block marker...
- BUG? pressing down from a longer line will jump over a shorter line - BUG? pressing down from a longer line will jump over a shorter line
- here is the line to jump from, for example from here - here is the line to jump from, for example from here
an we'll not get here... an we'll not get here...
@ -43,7 +44,6 @@ var setup = function(){
- ASAP: editor: bksapce/del at start/end of a block should join it with prev/next - ASAP: editor: bksapce/del at start/end of a block should join it with prev/next
- ASAP: editor: pressing enter in text edit mode should split text into two blocks - ASAP: editor: pressing enter in text edit mode should split text into two blocks
- ASAP: editor: shifting nodes up/down - ASAP: editor: shifting nodes up/down
- ASAP: editor: `-` at start of line is interpreted as block marker...
- ASAP: use \\t for indent... - ASAP: use \\t for indent...
- ASAP: scroll into view is bad... - ASAP: scroll into view is bad...
- on item click, place the cursor where it was clicked before the code expanded... - on item click, place the cursor where it was clicked before the code expanded...
@ -131,36 +131,39 @@ var setup = function(){
- ; ASM-style comment - ; ASM-style comment
- XXX Highlight - XXX Highlight
- Basic inline *bold*, _italic_ and ~striked~ - Basic inline *bold*, _italic_ and ~striked~
- Code
- Quoting `html <b>code</b>`
- Marking ==text== - Marking ==text==
- Code
- Inline quoting `html <b>code</b>`
- code blocks
```
var text = 'Hello, world!'
console.log(text)
```
_syntax higlighting not yet supported..._
- Line - Line
- --- - ---
- Markers: ASAP, BUG, FIX, HACK, STUB, WARNING, and CAUTION - Markers: ASAP, BUG, FIX, HACK, STUB, WARNING, and CAUTION
- Inline [X] checkboxes [_] - Basic task management
- To do items/blocks - Inline [X] checkboxes [_]
- [_] undone item - To do items/blocks
_(clicking the checkbox updates the item)_ - [_] undone item
- [X] done item _(clicking the checkbox updates the item)_
- [_] we can also add inline [x] checkboxes - [X] done item
- link - [_] we can also add inline [x] checkboxes
- links
- [example](about:blank) - [example](about:blank)
- https://example.com - https://example.com
- ./path/to/file /path/to -- not supported yet - ./path/to/file /path/to -- _not supported yet_
- Tables - Tables
- | a | b | c | - | a | b | c |
| 1 | 2 | 3 | | 1 | 2 | 3 |
| 11 | 22 | 33 | | 11 | 22 | 33 |
- Symbols -- should these be ligatures? - Symbols -- _should these be ligatures?_
- (i), (c), /!\, ... - (i), (c), /!\, ...
- -- and --- - -- and ---
- markdown: -
- numbered lists - ---
- ~tables~
- code blocks
- ~alerts~
- footnotes??
-
- ### Playground for testing - ### Playground for testing
- A - A
collapsed:: true collapsed:: true