Created attachment 199624 [details] Screenshot showing Writer and Calc unable to handle markdown tables pasted from clipboard The Markdown parser in GitLab's comments editor (and perhaps some other Markdown editors) automagically converts tabular content copied from LibreOffice Calc spreadsheets, but the reverse is not true. If you copy this Markdown table to your clipboard: | Sales | Europe | Asia | Africa | Atlantis | |---------|--------|------|--------|----------| | Apples | 434 | 545 | | 6656 | | Bananas | 5 | | 33 | 7657 | | Oranges | 677 | 535 | 3 | 4390 | ...and paste into Writer or Calc: * Calc can partially interpret it by guessing the "|" column separators, however it adds an extra column at the start, and doesn't handle the "---" row below the header row. * Writer doesn't parse it at all, it just pastes a plaintext mess. --- Tested with LibreOffice 25.2
Note that while the separator row is a requirement in Markdown's syntax, the separator row characters don't necessarily need to go edge-to-edge with the column separators, i.e. this syntax is also valid Markdown: | Sales | Europe | Asia | Africa | Atlantis | | ------- | ------ | ---- | ------ | -------- | | Apples | 434 | 545 | | 6656 | | Bananas | 5 | | 33 | 7657 | | Oranges | 677 | 535 | 3 | 4390 |
There is bug 162153 for Markdown import. If https://github.com/mity/md4c were to be used, "With the flag MD_FLAG_TABLES, GitHub-style tables are supported" https://wiki.documentfoundation.org/Development/GSoC/Ideas#Import_Markdown_files_into_LibreOffice_Writer *** This bug has been marked as a duplicate of bug 162153 ***
Hmm, I understand how you'd consider it part of "import Markdown" in general, but that's a much wider scope than just supporting Markdown tables "at least in Calc" (closer to the existing CSV importer code) to begin with… my ticket was more specific than the other one, which was mostly imagining Writer-like usecases without even considering Calc. I was also focusing on the "paste from clipboard" scenario, not "open a Markdown document", so I don't know if it all goes through the same codepaths?
(In reply to Jeff Fortin Tam from comment #3) > Hmm, I understand how you'd consider it part of "import Markdown" in > general, but that's a much wider scope than just supporting Markdown tables > "at least in Calc" (closer to the existing CSV importer code) to begin with… > my ticket was more specific than the other one, which was mostly imagining > Writer-like usecases without even considering Calc. > > I was also focusing on the "paste from clipboard" scenario, not "open a > Markdown document", so I don't know if it all goes through the same > codepaths? Why would we consider Markdown tables in Calc separately? It would be extremely niche. If we add support via a library, it will be much easier to implement for Calc as well.