BlackGlory / copycat

🌳 Copy content from web powerful than ever before.
https://chrome.google.com/webstore/detail/jdjbiojkklnaeoanimopafmnmhldejbg
MIT License
266 stars 35 forks source link

tables with multiline text #10

Closed AntonioGHub closed 1 year ago

AntonioGHub commented 4 years ago

It is rather common and annoying to find, on the internet, table cells which have new lines in.

The new lines are rendered as they are, i.e. as new lines, which clashes with the new line character used in markdown to separate rows. As a result, html tables which contain <br> or <p> elements break the rendered markdown.

For instance an html table structured like this:

|  heading 1   |   heading 2   |
|--------------|---------------|
| a line       | just one line |
| another line |               |
|--------------|---------------|
| and so       |               |
| on           |               |
|--------------|---------------|
|              |               |

might be rendered preserving the <br> and <p> tags

|       heading 1        |   heading 2   |
|------------------------|---------------|
| a line<br>another line | just one line |
| and so<p>on</p>        |               |

And, if it may make sense, and could be easy to implement, it could be useful to implement some dialect that supports multiline-row and recursively render the cell content as a new markdown text. So for instance complex formatting might be preserved within a cell (for instance bulleted lists, italics and so on):

|   heading 1    |   heading 2   |
|----------------|---------------|
| * a line       | just one line |
| * another line |               |
|----------------|---------------|
| and so         |               |
| _on_           |               |
|----------------|---------------|

(see azure devops - How can I add a table with multi-row cells to a readme in VSTS? - Stack Overflow for info about multi-line tables).

BlackGlory commented 1 year ago

Copycat's support for Markdown is expected to switch to remark ecosystem, but remark ecosystem also does not support multi-line text tables.