redbug312 / markdown-it-multimd-table

Multimarkdown table syntax plugin for markdown-it markdown parser
MIT License
144 stars 37 forks source link

Add custom extension for nowrap in columns #72

Open markg85 opened 3 weeks ago

markg85 commented 3 weeks ago

Hi,

Right now if you want to do no text wrapping in a table you'd have to wrap your content in a span to do this. In bootstrap that would be like: <span class="text-nowrap">your content</span>

Or a full table example:

| Option | Description                                                               |
| ------ | ------------------------------------------------------------------------- |
| <span class="text-nowrap">aa</span>     | bla                                      |
| aa     | bla                                                                       |

Sparkling html in a - essentially - ascii formatted table is just ugly.

Now, sadly, markdown isn't consistent with itself as it already has no wrapping code blocks like this:

aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc aaa bbb ccc 

And other markdown renderers (not the github one) interpret a single exclamation mark as enabling word wrapping

```!
... some large single line content would wrap in some markdown renderers.
```

With that in mind, i propose we follow the exclamation (or bang) symbol: ! = wrapping. Let's consider this the "implicit default" because other renderers (like HedgeDoc) support this in fenced blocks. !! = the inverse, so no wrapping.

I propose to add this on a column and a cell level. So some examples:

Cell level content wrapping

| Option | Description                                                               |
| ------ | ------------------------------------------------------------------------- |
|!! aa   | 11                                                                        |
| bb     |!! 22                                                                      |

Here the content of the columns aa and 22 would not be wrapped. bb and 11 would be wrapped.

Column level content wrapping

| Option | Description                                                               |
|!! ---- | ------------------------------------------------------------------------- |
| aa     | 11                                                                        |
| bb     | 22                                                                        |

Here the columns (that also arranges alignment like: :--, --: etc..) is modified. All the content in every column below the one that has !! (so aa and bb) should not be wrapped. The columns 11 and 22 are still wrapped.

Any thoughts on this?