text icon indicating copy to clipboard operation
text copied to clipboard

Allow line breaks in table rows

Open theroch opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. We want to have line breaks in table rows to format the text. Othe markdown viewers/editors allow this by using <br> or <br /> tags.

Describe the solution you'd like Support <br> tags or other formating tags to allow line breaks in table rows like this:

| **Org** | **Name** | **Contact** |
|-----|------|--------------|
| Org | Name | E-Mail: [email protected] <br> Tel: 01/ 123456789 |

Describe alternatives you've considered We already tested with double spaces, \, \n,
nothing works.

Additional context See also https://stackedit.io/app#

theroch avatar Jul 16 '22 13:07 theroch

Sounds reasonable to support that, even if that is not something that makes the output markdown table very readable.

Any thoughts @max-nextcloud ?

juliusknorr avatar Jul 19 '22 15:07 juliusknorr

We should support the <br> syntax as this is the most common one, \ is only supported by pandoc (as far as I know).

susnux avatar Jul 19 '22 17:07 susnux

Not sure about the <br> syntax as that feels like a first step to introduce HTML into our markdown set. What do others think? @vinicius73, @max-nextcloud, @juliushaertl, @juliushaertl, @jancborchardt?

mejo- avatar Oct 05 '22 12:10 mejo-

My main concern about HTML would be that we properly need to ensure to purify/sanitize it, though I think tiptap/prosemirror might already take care of that quite well.

juliusknorr avatar Nov 14 '22 22:11 juliusknorr

The security recommendations of markdown-it say:

markdown-it provides 2 possible strategies to produce safe output:

  1. Don't enable HTML. Extend markup features with plugins. We think it's the best choice and use it by default. - That's ok for 99% of user needs. - Output will be safe without sanitizer.
  2. Enable HTML and use external sanitizer package.

I'd like to avoid enabling HTML. But I think we could support <br> without enabling it. It would require us to parse <br> and <br /> inside a table as a token of it's own and turn it into a <br> tag when parsing the markdown. I think tiptap would handle that <br> tag just fine.

We'd also need to serialize <br> tags in tables to that token in the toMarkdown function of table cells or so.

max-nextcloud avatar Nov 15 '22 07:11 max-nextcloud