disabled manual headings + notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-12-17 06:08:46 +03:00
parent 29650ba7c9
commit d5950dc742
3 changed files with 29 additions and 17 deletions

View File

@ -380,34 +380,34 @@
border-bottom: solid 1px rgba(0,0,0,0.1);
}
}
.auto.heading .auto.heading .auto.heading .auto.heading>.text,
.heading .heading .heading .heading>.text,
.heading-4>.text,
.heading-5>.text,
.heading-6>.text {
border-bottom: none;
}
.auto.heading>.text,
.heading>.text,
.heading-1>.text {
--font-size: 2.5em;
}
.auto.heading .auto.heading>.text,
.heading .heading>.text,
.heading-2>.text {
--font-size: 1.9em;
}
.auto.heading .auto.heading .auto.heading>.text,
.heading .heading .heading>.text,
.heading-3>.text {
--font-size: 1.5em;
}
.auto.heading .auto.heading .auto.heading .auto.heading>.text,
.heading .heading .heading .heading>.text,
.heading-4>.text {
--font-size: 1.3em;
}
.auto.heading .auto.heading .auto.heading .auto.heading .auto.heading>.text,
.heading .heading .heading .heading .heading>.text,
.heading-5>.text {
--font-size: 1.1em;
}
.auto.heading .auto.heading .auto.heading .auto.heading .auto.heading .auto.heading>.text,
.heading .heading .heading .heading .heading .heading>.text,
.heading-6>.text {
--font-size: 1em;
}

View File

@ -216,6 +216,7 @@ var attributes = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// XXX convert auto-heading to markdown heading level and back...
var blocks = {
__proto__: plugin,
@ -223,6 +224,7 @@ var blocks = {
return text
// markdown...
// style: headings...
/* XXX chose either this or auto headings -- move docs...
.replace(/^(?<!\\)######\s+(.*)$/, this.style(editor, elem, ['heading', 'heading-6']))
.replace(/^(?<!\\)#####\s+(.*)$/, this.style(editor, elem, ['heading', 'heading-5']))
.replace(/^(?<!\\)####\s+(.*)$/, this.style(editor, elem, ['heading', 'heading-4']))
@ -230,11 +232,12 @@ var blocks = {
.replace(/^(?<!\\)##\s+(.*)$/, this.style(editor, elem, ['heading', 'heading-2']))
.replace(/^(?<!\\)#\s+(.*)$/, this.style(editor, elem, ['heading', 'heading-1']))
// XXX EXPERIMENTAL
// XXX rename css class to "heading"
// XXX chose either this or manual headings...
// XXX if this is used change syntax to '#'
//.replace(/^(?<!\\)#\s+(.*)$/, this.style(editor, elem, ['heading']))
.replace(/^(?<!\\)@\s+(.*)$/, this.style(editor, elem, ['heading', 'auto']))
.replace(/^(?<!\\)@+\s+(.*)$/, this.style(editor, elem, ['heading', 'auto']))
/*/
// XXX EXPERIMENTAL
.replace(/^(?<!\\)#+\s+(.*)$/, this.style(editor, elem, ['heading']))
.replace(/^(?<!\\)@+\s+(.*)$/, this.style(editor, elem, ['heading', 'no-toc']))
//*/
// style: list...
//.replace(/^(?<!\\)[-\*]\s+(.*)$/m, style('list-item'))
.replace(/^\s*(.*)(?<!\\):\s*$/, this.style(editor, elem, 'list'))
@ -640,8 +643,9 @@ var toc = {
for(var e of [...root.querySelectorAll('.block.heading>.view')]){
var block = editor.get(e)
// skip the root element???
if(!that.__skip_local_root__
&& block === root){
if(block.classList.contains('no-toc')
|| (!that.__skip_local_root__
&& block === root)){
continue }
var d = level(e, root)
// down...
@ -669,7 +673,7 @@ var toc = {
var list = makeTOC()
for(var toc of TOCs){
toc.innerHTML = ''
toc.append(list) }
toc.append(list.cloneNode(true)) }
// local tocs...
for(var toc of tocs){
toc.innerHTML = ''
@ -1094,6 +1098,7 @@ var JSONOutline = {
// XXX
json: function(){},
// XXX add plugin hooks...
// XXX add option to customize indent size...
text: function(node, indent, level){
// .text(<indent>, <level>)

View File

@ -45,6 +45,8 @@ var setup = function(){
- Google Keep (editor)
-
- // Seems that I unintentionally implemented quite a chunk of the markdown spec ;)
- ### Index
- TOC
-
- ## Bugs:
focused:: true
@ -141,8 +143,13 @@ var setup = function(){
|text|text|text|
-
- ## ToDo:
- Q: should auto-headings be exported as normal/manual markdown headings???
- expand sub-tree on follow link...
- TOC: Q: should we have both manual and auto headings???
- IMHO: no...
- DONE TOC: headings that do not show up in toc -- `# ...` shows up while `@ ...` does not...
- TOC: tweaking: add args like depth, ...
- ASAP: expand sub-tree on follow link...
- export auto-headings as normal/manual markdown headings...
- plugin callback on save...
- Time to think about a standalone client -- at least to edit own notes as a test...
- _also this would be a nice opportunity to start the move to a newer electron version_
- Might be a good idea to think how to avoid the constant selections on focus...