nextcloud / text

📑 Collaborative document editing using Markdown
GNU Affero General Public License v3.0
555 stars 91 forks source link

Add Markdown table support #114

Closed skjiisa closed 2 years ago

skjiisa commented 5 years ago

Is your feature request related to a problem? Please describe. Yes. Documents with Markdown tables do not have their tables rendered.

Describe the solution you'd like Standard Markdown table rendering.

Describe alternatives you've considered As developing a UI for making tables could be difficult, simply using the standard Markdown to HTML table conversion would be enough.

juliusknorr commented 5 years ago

Yes, we should look into implementing support for https://github.github.com/gfm/#tables-extension-

jancborchardt commented 5 years ago

@Isvvc is this something you would like to help contribute? 😊 The Text app is of course at the first version, and any contribution is welcome – we’ll help you get set up if you need anything.

skjiisa commented 5 years ago

@jancborchardt I could definitely make an attempt but am not sure exactly where to start. I have experience with text manipulation but none with Nextcloud apps or Vue.js.

jancborchardt commented 5 years ago

@Isvvc cool! Maybe @juliushaertl or someone from @nextcloud/vue has some pointers to help. :)

ChristophWurst commented 5 years ago

For Vue I suggest to read the Vue docs and then some code from Nextcloud apps. This will make you understand how we use it here.


someone from @nextcloud/vue has some pointers to help. :)

I would kindly ask to not abuse the team for stuff like this. This just floods everyone's notifications. The maintainers of this app should be able to help.

Unsubscribed. Please @mention me directly if you need any specific help.

juliusknorr commented 5 years ago

Regarding the integration tables, I would recommend to first have a look at the tiptap table nodes to see what they support and how/if we can represent that in github flavored markdown. Since most likely not all will be supported, we need to create our own table nodes or inherit from the tiptap ones and add them to https://github.com/nextcloud/text/blob/master/src/EditorFactory.js#L45-L59

Here are some rough steps with code hints:

elpraga commented 5 years ago

Is there a roadmap as approximately when this functionality could be implemented?

juliusknorr commented 5 years ago

No, there is no estimation that we can give. Of course contributions are always welcome.

elpraga commented 5 years ago

@juliushaertl I wish i were able to contribute with the code. I'm an English teacher, not a coder. Even though I did have a look at tiptap tables (they work great BTW), I was not able to make them work locally.

I'm grateful that nextcloud exists and gives us the freedom to host files at home instead of having to rely on a big corporation. I do file bug reports and try to contribute with suggestions, but, unfortunately, I cannot contribute with code.

Thank you for your work, and if tables in the text app could be implemented, it would be much appreciated.

juliusknorr commented 5 years ago

@elpraga Thank you very much the kind words. Keep your contributions coming :wink:

jonathandeclan commented 5 years ago

Since this uses tiptap, I don't understand why we don't have tables https://tiptap.scrumpy.io/tables

guddl commented 5 years ago

Since this uses tiptap, I don't understand why we don't have tables https://tiptap.scrumpy.io/tables

Yes please :-)

juliusknorr commented 5 years ago

@jonathandeclan @guddl Please read https://github.com/nextcloud/text/issues/114#issuecomment-507180208 and use Github Reactions feature instead of commenting that also need a specific feature. That way we can see your support without notifying all users subscribed to a given issue without adding anything new to the discussion.

TLDR: As tiptap doesn't have markdown support out of the box, additional implementation work is required. Contributions are always welcome.

jakobroehrl commented 4 years ago

It would be awesome if the tables could be sorted and are filterable :)

marbx commented 4 years ago

I happily used markdown tables and assumed there were a standard feature of Nextcloud.

After an upgrade from Nextcloud 16 to 17, my markdown tables are no longer rendered as html table.

Can someone confirm that Nextcloud 16 renders markdown tables?

I resolved my markdown table support need via the Pico CMS app.

Therefore I no longer require this enhancement.

davidbe commented 4 years ago

It would be nice to hav an implementation like this: https://blog.documentnode.io/when-markdown-meets-tables

fajabird commented 4 years ago

What about an option to switch to raw markdown editing so any formatting supported by the rendering engine can be used even when not supported by the text-editing UI. This of course would require the support of extended markdown syntax by the engine.

I think as this editor used markdown in the backend there should always be an option to switch to RAW mode and supported elements should be rendered as expected. E.g. when I copy paste an markdown file to my nextcloud foldert and open it with Text it should display all elements correctly, not only those that are supported by the UI. For the time beeing those not supported by the UI could be marked so its obvious that those can only be edited from the RAW mode.

juliusknorr commented 4 years ago

@fajabird See #123

asoltesz commented 4 years ago

This is a pretty big blocker for any realistic use of PicoCMS with NextCloud since any moderately complex page will contain tables.

Daksol commented 3 years ago

Version of Markdown in Mattermost would be useful, it has Tables.

aharish commented 3 years ago

Just stumbled across this. I will pick this up over the weekend and see if I can help contribute something. Never written in Due Vue before, but I have a solid understanding of other JS frameworks, so it mustn't be that hard to reorient myself.

I have worked with Markdownit on other platforms previously, so I think I should be able to contribute a very simple working version of table rendering support on the fancy pants editor.

juliusknorr commented 3 years ago

@aharish Feel free to ping me if any questions come up :)

mikini commented 3 years ago

For people looking for an existing work-around for table rendering in Nextcloud, the possibility exists to install the Markdown Editor app which includes a combined plain text editor and Markdown render with table support (also based on markdown-it which supposedly supports GFM tables by default).

b3 commented 3 years ago

@mikini This is not the same use case: there is no current multi-user support in Markdown Editor or am I missing something?

mikini commented 3 years ago

As I understand Isvvc's request, it primarily regards rendering of a markdown formatted file. Editing is not mentioned in the original issue text at all and Markdown Editor is able to do rendering of tables.

But you are right about collaborative editing not working using Mardown Editor. Just tested on my NC 20.0.7 instance with Markdown Edtior 2.3.3 and Plain text editor 2.14.0. Using the Markdown Editor requires reload of the file to pick up changes to the document, and will result in conflict and lost edits if two users are editing simultaneously. And if mixing editing with text (this application) it seems to be even more messy, so that is definitely not a work-around to recommend on multi-user instances. Markdown Editor has a 3 year old issue for collaborative editing but it has seen no activity so I guess it is unlikely to see that implemented.

FrViPofm commented 3 years ago

Multi-editor solution could come in a second time. I think the main needs are for an editor :

  1. that don't break the code (tables and yaml)
  2. that can edit table (and yaml) in raw mode and preview it
  3. that work on table in wysiwyg mode in single-user mode
  4. that work on multi-user mode
  5. that make the coffee and have a tour outside with the pet.
johnwry commented 3 years ago

Is there any progress on this issue? I can't make tables render

johnwry commented 3 years ago

I found my issue. I was using Nextcloud's default Text app and I should have been using the Plain Text editor app instead along with Markdown editor.

MADXhh commented 2 years ago

I cannot render tables.:-( Which app exactly do I have to use/install? And which table syntax can I use?

I just clicked on the plus sign, created a new file Test.md and added the following:

Item Price # In stock
Juicy Apples 1.99 7
Bananas 1.89 5234

Unfortunately, the table is not displayed/rendered as a table, only the plain text. NC version 22

Many thanks in advance for your support

mejo- commented 2 years ago

Hey @MADXhh, thanks for your feedback. Unfortunately, rendering tables is not supported by the Nextcloud Text app yet. It's a high-priority issue though and we most likely start working on it soon :blush:

lebraseric commented 2 years ago

As a simple workaround, I use the code block syntax, like this:

| Révision au | Montant en Euros |
|:-----------:|:----------------:|
|  01/01/2021 |     641,38 €     |
|  01/01/2020 |     641,75 €     |
|  01/01/2019 |     636,93 €     |
|  01/01/2018 |     626,62 €     |
|  01/01/2017 |     619,76 €     |
|  01/01/2016 |     616,36 €     |

(enclose the table with ``` before and after).

ktprograms commented 2 years ago

Hi, I think I may have thought of a way to edit tables in a html textarea, inspired by emacs org mode tables.

You can try it out by opening https://ktprograms.codeberg.page/table_editor_html/@master/, the instructions are at the top of that page.

You can leave feedback on the issues page for my repo, or on this issue thread.

Thanks!

aharish commented 2 years ago

Hi @ktprograms, this issue is not about typing down the table itself, it is about the Markdown renderer that Text uses not rendering those Markdown tables in HTML. While your provided solution is a good enhancement, it is not relevant to this issue. I would recommend that you create a new issue and post this there. Even better would be if you could submit a PR with this implemented on the Text app. It would be a nice enhancement to have!

Happy New Year and best wishes!

ktprograms commented 2 years ago

@aharish I see, thanks! I'll see about creating a PR but the current code is very minimal and needs more work.

The idea I was having was to use this in Nextcloud Notes, where (since the checkboxes are already only rendered in edit mode), the table wouldn't actually need any rendering since the Markdown table format is readable as-is.

max-nextcloud commented 2 years ago

I had a brief look at tiptap tables, markdown table syntax (gfm). Gfm tables are really lightweight. They do not allow for other nodes inside the tables - so no lists or even multiple paragraphs in the table cells. This will make tables somewhat less powerful but also easier to implement.

I think a meaningful first step would be rendering existing tables in Markdown, showing them in the editor and allowing to change the content. This would require:

If we add all that we would be able to:

It would not include menu bar items to create a table, add / delete rows and columns, change alignment etc. I think this would significantly reduce the need for UI discussions around creating / editing table structures.

juliusknorr commented 2 years ago

Sounds good, we can look into the table inserting and adding/removing columns in a second step.

mejo- commented 2 years ago

Thanks for looking into this @max-nextcloud, sounds really promising :+1:

I also think that keeping tables simple makes sense. There's no way to represent tables with multiline cells or other complex formatting inside the cells in markdown anyway, so it makes sense to me to restrict this to single-line tables and only marks (no futher nodes) allowed inside them.

We definitely need menu bar tools for creating/modifiying tables in my opinion, but that certainly can happen in a second step.

ajoana commented 2 years ago

Multi-editor solution could come in a second time. I think the main needs are for an editor :

  1. that don't break the code (tables and yaml)
  2. that can edit table (and yaml) in raw mode and preview it
  3. that work on table in wysiwyg mode in single-user mode
  4. that work on multi-user mode
  5. that make the coffee and have a tour outside with the pet.

As a normal user, what could I do to stimulate progress on this issue? Could I sponser someone to get it done quickly? To me, the limitations of the default text app is a MAIN show stopper to better use and recommend NC. I love collectives (text app mandatory) and wish to publish parts of the collectives using pico cms or other online md publishing tools.

  1. this would be an urgent request (see pico cms and other issues)
  2. could be a second step after 1.
  3. this is an urgent request seeing this open here more than 1,5 years.
  4. could be a second step after 3 - I don't see this important for our group as focus is on collectives
max-nextcloud commented 2 years ago

Hi y'all.

Thanks for your input on this issue. I'm working on it right now. My implementation aims to follow what text does in general. First of all because of consistency, second also because it's easier. So i am aiming at:

  1. collaborative edititing
  2. rendering the tables in the editor and editing them rather than the source code
  3. preserving the meaning of markdown - but not necessarily the exact code.

With respect to 2. I hope to look into a markdown view at some point but that would be for all of text - not just for tables.

Regarding 3. I am investigating ways to minimize the diff when editing markdown files in text. For now we read the entire file, convert it to html, load it into tiptap, fetch the html from tiptap and then store that as markdown. We'll have to keep track of the initial markdown or at least some of its properties to preserve it. This is best discussed in #593.