logoalt Hacker News

freedombenyesterday at 7:51 PM3 repliesview on HN

> Making a quick manual change like adding column to a markdown table is just unfun.

This is one of those moments where I realize that the vim life spoils me. It's so easy to do this in vim that I don't even think about. I probably use it a dozen times per day such as commenting out code.

Ctrl + v, select where you want the character, then hit I (shift + i), type your thing, hit escape, and Bob's your uncle.


Replies

jezyesterday at 8:16 PM

Even in Vim, the editing experience falls over when making markdown tables that have non-trivial content in their cells (multiple paragraphs, a code block, etc.). I recently learned that reStructuredText supports something called "list tables":

https://docutils.sourceforge.io/docs/ref/rst/directives.html...

Where a table is specified as a depth-2 list and then post processed into a table. Lists support the full range of block elements already: you can have multiple paragraphs, code blocks, more lists, etc. inside a list item.

This syntax inspired the author of Markdoc[1] (who came from an rST background) to support tables using `<hr>`-separated lists[2] instead of nested lists (to provide more visual separation between rows).

I have found various implementations of list table filters for Pandoc markdown[3][4], but have never gotten around to using any of them (and I've tossed around ideas of implementing my own).

[1] https://markdoc.dev

[2] https://markdoc.dev/docs/tags#table

[3] https://github.com/pandoc-ext/list-table

[4] https://github.com/bpj/pandoc-list-table

show 1 reply
thunderbongtoday at 1:59 AM

That's basically any editor with multi-cursor capability.

nine_kyesterday at 8:06 PM

Same in Emacs, and, I suppose, in any editor with enough self-respect to support vertical blocks.