You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When editing tables, it can be nice to have the editor automatically add padding to make the columns line up. The following implements this behaviour in a way that works flawlessly, without being intrusive or diverging from vanilla markdown:
TLDR, you can start a table by typing | and then typing the first column title, then press Tab, Shift-Tab, Return, and Shift-Return to move focus around the table, and it automatically creates new rows and columns, and adds or removes padding. The table manipulation only happens when you press certain keys to navigate the table, not in real time while you're typing. There's also no UI, so it doesn't add any clutter.
Back when I used Obsidian, I used a plugin that implemented this kernel, and it was a complete game changer. Is this the kind of thing you would consider adopting?
There is also a fork of the original repo that is still maintained, but it's been converted to Typescript and has more spreadsheet features added to it, which I suspect takes it somewhat out of the intended scope of MarkEdit. I think the relevant code sample from that repo is this one:
Activity
cyanzhong commentedon Sep 5, 2024
Thank you for your feedback. This is not a bad idea.
In my opinion, table editing in Markdown is frustrating and should not have been invented..
The
ITextEditorprotocol looks interesting to me, I am thinking about if conforming to that interface would let you integrate a built mte-kernel JS lib with the existing https://github.com/MarkEdit-app/MarkEdit/wiki/Customization mechanism.However, its documentation is no longer available: https://doc.esdoc.org/github.com/susisu/mte-kernel/class/lib/text-editor.js~ITextEditor.html. I also have concerns since it's no longer being maintained.
Do you know where I can find sample code for this protocol?
piperdeck commentedon Sep 5, 2024
There's an implementation for the defunct Atom text editor, I think these are the relevant code samples:
https://github.com/susisu/atom-markdown-table-editor/tree/master/lib
There's also the code for the
mte-kerneldemo:https://github.com/susisu/mte-demo/blob/master/src/main.js
There is also a fork of the original repo that is still maintained, but it's been converted to Typescript and has more spreadsheet features added to it, which I suspect takes it somewhat out of the intended scope of MarkEdit. I think the relevant code sample from that repo is this one:
https://github.com/tgrosinger/md-advanced-tables/blob/main/src/text-editor.ts
That's all I could find, but hopefully it helps
cyanzhong commentedon Sep 9, 2024
I am making a bunch of changes in order to support this:
markedit-apirepo to provide api declarations.markedit-apiinterfaces.mte-kernel.Related but not required, I've made the preview button of tables a bit nicer:
piperdeck commentedon Sep 10, 2024
Amazing! Super looking forward to this!
cyanzhong commentedon Oct 3, 2024
It has been released and I've just updated the extension to include "format" and "format all" as well: MarkEdit-app/MarkEdit-mte@7c676cb.