Advanced Tables Plugin

Here’s the beginnings of a plugin to bring the fantastic mte-kernel for markdown table editing to Obsidian. This plugin will automatically format and resize your markdown tables, and make adding and removing columns and rows super simple.

Not quite all of the features are there yet, but the core is in place. Check back soon :slight_smile:

You may also be interested in my other plugins:

  • Recent Files - Just displays your recently viewed files :slight_smile:
  • Slated - Task management in Obsidian
60 Likes

Hey @tgrosinger,

This is quickly becoming one of my favorite plugins.
There was another initiative for table plugin where I’ve mentioned org-mode tables

Your table system is really close to replicating some of the amazing stuff possible in org-mode tables

I recorded a short video to show what I’m talking about

table-spacemacs-2020-10-09

I think if your plug in was able to replicate some of org-mode’s functionality it would be amazing!

Thanks for your hard work with this great plugin

1 Like

@santi, thank you very much for the kind words.

Org-mode is absolutely an inspiration and a goal. I imagine this plugin starting off by adding the remaining functionality from the mte-kernel library, but then expanding to add more org features.

Is there anything from org you would like to see first? A prioritized list of what people want most in tables would be helpful. Org-mode handling of tables is pretty intense, so it’ll likely take some community effort to get anywhere close to that.

5 Likes

Sounds great man, yeah I can see how org-mode would be a huge challenge.

I’m still pretty new to programming (currently learning javascript), as much as I’d love to contribute, my skill level is still not advanced enough, but I’m happy to test things out and provide feedback where I can. Hopefully as I improve I can provide some help.

Personal Priority of Table functionality

Regarding org mode table functionality.

The creation of the table (as seen in the video demo)
I think just having this way to set up a table easily would be amazing.

Having that ability in obsidian would be a huge time saver, since I alway end up going to spacemacs to create tables to use in obsidian.

Keep up the amazing work @tgrosinger feel free to reach out if you ever need anything!

@tgrosinger: excellent initiative !! Tables are 1 of my favourite uses in markdown and don’t like the native markdown way, so I missed this.

When I enable the plugin in the Obsidian settings, it disables when I leave the settings.

Edit: this is sorted, thanks to @argentum. I had downloaded your master zip file instead of the release zip file.

Nevertheless, I have a question. You mention that it works in monospaced font. I don’t use that because I want my Edit mode to resemble Preview as much as possible: pseudo-WYSIWYG.

Is there any way to make your plugin work with other fonts too?

This was one of the main features that I was missing. This plugin is a game-changer for me.

I use monospace only in my code-blocks. Because a monospace font is necessary for this plugin, is it possible to render tables in code blocks?

@Klaas this plugin does not actually care what font you are using. The only reason I say it works best with a monospaced font is because spaces are used to pad cell width. This is best explained with an example.

| One | Two | Three | Four |
| _— |----------------| ------ | ---- |
| 1 | Longer Content | 3 | 4 |
| some | 2 | | |

| One  |      Two       | Three  | Four |
| ---- |:--------------:| ------ | ---- |
| 1    | Longer Content | 3      | 4    |
| some |      2         |        |      |

That’s the exact same text. But notice how in the monospaced font (the second one) everything looks all nice and lined up?

So like I said, you can use any font you like, it just looks a little better in the non-rendered mode in a monospaced font.

1 Like

@wouterb That’s part of how markdown is rendered, which this plugin does not alter. Text in code blocks are treated as is and won’t be interpreted specially.

But see my message above about the difference between using monospaced and normal fonts. It’s definitely not required.

@tgrosinger: OK, that’s clear. It means that there is no point in using this plug-in without monospaced font in Edit mode, as you warned.

This plugin actually does add a lot of functionality still even if you do not use a monospaced font. It will improve navigation between cells (currently ctrl+tab, but I’m working on changing that to just tab, like Excel) and it dramatically simplifies adding new columns and rows to existing tables.

Take a look at the animation on the Github page for an example of how it creates the table for me.

@tgrosinger: please don’t think I denigrate the plug-in, not at all. I think you have done a great job, and I am probably in a minority to use the same font in Edit as in Preview mode.

I had seen the animation on Github, which is why I installed the plug-in eagerly. But when I created a table as a test nothing was actually done by the plug-in, such as adding the dashes below the 1st line.

So, my impression then was that monospaced is not just a recommendation but an absolute must for this to work. Maybe I am wrong, but with my Baskerville font there is no interaction.

Hmm, it sounds like it might not be enabled, or the hotkeys might be conflicting? Regardless of your font, if you type | Test and then press ctrl+tab it should transform that into

| test | X
| ---- |

with the X denoting where your cursor will be. If this is not the case please either DM me or open an issues on GitHub so we can get to the bottom of it!

@tgrosinger: just to let you know, FWIW, that I changed my Edit font to monospaced, and you plug-in works fine !! Many thanks for that plug-in.

As an aside, I still wanted to keep my pseudo-WYSIWYG set up, so I changed the Preview font to monospaced too.

1 Like

Hi, it’s me again. Is there a way to prettify existing tables using your plug-in? I am talking about tables that were created before your plug-in even existed.

Yes, the plugin should definitely work with any markdown table, regardless of when it was created. Just put your cursor in the table and use the “Format table at cursor” command form the command palette.

Also just a heads up, in the latest version of the plugin (0.3.2) there is a new options in the settings to turn off the cell padding with spaces. This makes it a little more friendly to use in a non-monospaced font. It doesn’t make the table quite as pretty (in my opinion), but it will still clean it up and make it consistent.

@tgrosinger: yep, that works. A rather silly question I guess: is it possible to undo such a format? The reason I ask is I have a rather big table, and when I do the format it goes way off screen. I tried to use Cmd+Z (= undo) but that does not work.

Actually, is there a way to wrap long text?

As for using with non-monospaced font, I won’t need it anymore because I have changed to monospace in Edit and in Preview - pseudo-WYSIWYG. Using monospaced in Edit can never do any harm/prevent other plug-ins from working properly.

Hmm, as far as I am aware undo should be working. If you are using vim mode you may need to instead press Escape, then “u”. If you are not on the latest release then you may need to undo a few times, but the latest release should group all the changes into one action.

I am not aware of a way to wrap text in a markdown table :frowning: but let me know if you find anything.

There’s a new version out (0.4.0) with a greatly improved interface for using the table manipulation commands. Checkout the new demo gif on the Github page.

2 Likes

Hi @tgrosinger this plugin looks great. I understand that both the API itself and the plugin are both in Alpha state, but just wanted to let you know that I could not get it to work on my setup. I’ve tried:

  • Installing from Obsidian and manual install
  • Different Vaults (even a blank one)

I am in Obsidian 0.9.10 and trying 0.4 version of the plugin. Happy to provide any more information about my setup if it can help debug.

Thanks,
Mariano

Hi @tgrosinger!

I’d very much like to use this plugin, but it fails to load — I have a message saying so, when I try to activate it. I’ve tried to quit and relaunch Obsidian, without success.

Obsidian version : 0.9.10
Installer version : 0.9.6