threepointone/markdown-in-js

Github-flavored markdown tables

Opened this issue · 0 comments

What do you think about supporting gfm tables? Commonmark explicitly doesn't support them, but I use them pretty frequently and find them to be much more convenient compared to inlining a bunch of HTML.

I considered 4 implementations:

  1. Allow multiple markdown parsers (sorta like what eslint does)
  2. Fork commonmark and add table parsing
  3. Use marked parser instead of commonmark
  4. Just hack it in

Options 1 and 2 both sounded like a pain to write and maintain, and 3 seems maybe sensible but a pretty big, time-consuming change needing more discussion. So I went with 4, of course 😄

I hackily added them in using an excerpt from the marked parser. In my limited testing, it seems to work pretty well. I'm sure there are weird edge cases and gotchas, though. You can check it out here: #6.

Let me know what you think. I'm not really sure if this is the right direction, it was just the one I had time to hack in!


Example gfm table:

Left-aligned Center-aligned Right-aligned
git status git status git status
git diff git diff git diff