zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.2k stars 1.9k forks source link

markdown table could not display when imported #2026

Closed kkonghao closed 1 year ago

kkonghao commented 3 years ago

import result is: image

zadam commented 3 years ago

Hi, Trilium uses CommonMark parser. Tables in Markdown are not standardized and (I assume) therefore not supported by this library.

b3taman commented 3 years ago

Is it possible to add the ckeditor5-markdown-gfm plugin? Their example at https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html includes a table. Since it is GitHub Flavoured Markdown, lots of people will be very happy.

zadam commented 3 years ago

That's a different thing. Import (and conversion) happens on the backend, CKEditor is not involved in the import process.

b3taman commented 3 years ago

Thank you for the reply [especially thank you for creating this — I have been using it for a few days and see enormous potential for positive impact in my life].

I understand; perhaps this should be the start of a new thread, because it has shifted to using the editor and is no longer about importing MD-formatted files.

If the ckeditor5-markdown-gfm plugin were to be used, then I assume the following would hold:

  1. The ability to use full GitHub MD syntax.
  2. The ability to switch between interpreted ("WYSIWIG") mode and "raw" mode. In the latter you would see the actual markdown code.

Both would be extremely useful. Is it possible?

zadam commented 3 years ago

I don't plan to do this. Trilium is not meant to be Markdown editor. Having Markdown option would mean doing a lot of things twice, various incompatibility issues etc.

b3taman commented 3 years ago

Your call, obviously. I guess I misunderstood the scope of second and the second-last bullets under Features at the GitHub page.

It looks like Trilium is a fantastic fit for so much I would like to do, so I guess I'll be discovering more as I go along.

Thanks for your work on it.

pcause commented 3 years ago

There seem to be a number of libraries that will convert commonmark but also gfm, handle tables and other things. Looking at the code for importer, seems these could drop in without huge amount of work. The dialogue for import would need to have an option on which to pick if you allwed multiple, or if one, which options to enable. These seemed widely used/promising:

markdown-it showdown marked

olunju commented 2 years ago

Hi, Trilium uses CommonMark parser. Tables in Markdown are not standardized and (I assume) therefore not supported by this library.

Hi! zadam , I was looking for someone with a similar problem and I saw this, When exporting as markdown file, the code block is not wrapped with ' ``` ', is this normal?

zadam commented 2 years ago

According to common mark it is possible to either use ``` or four spaces. The converter uses four spaces.

olunju commented 2 years ago

According to common mark it is possible to either use ``` or four spaces. The converter uses four spaces.

sorry, I always thought only use ```

antoniotejada commented 2 years ago

I wasted some time debugging why table importing wasn't working, so I added a note to the wiki https://github.com/zadam/trilium/wiki/Markdown/3686af75918ba299fb47a16b3245ef2006a508fb

For reference this is Commonmark's position regarding tables

samchugit commented 2 years ago

According to common mark it is possible to either use ``` or four spaces. The converter uses four spaces.

sorry, I always thought only use ```

It's not a trilium problem, but I got a workaround by modifying some source code and needs to recompile. See #2963.

olunju commented 2 years ago

It's not a trilium problem, but I got a workaround by modifying some source code and needs to recompile. See #2963.

Thank you for your reply. Maybe I will try it

livingfree2023 commented 1 year ago

still hoping to have table markdown to take notes from ChatGPT

zadam commented 1 year ago

support for tables will be in 0.61