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... */
.editor .outline .block>.view pre,
.editor .outline .block>.view code {
padding: 0.1em 0.3em;
font-family: monospace;
background: rgba(0,0,0,0.07);
border-radius: 0.2em;
}
.editor .outline .block>.view pre {
padding: 1em 1em;
padding-bottom: 1.5em;
}
/* Tables... */

View File

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

View File

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