gh4a icon indicating copy to clipboard operation
gh4a copied to clipboard

Add support for GFM tables

Open eush77 opened this issue 9 years ago • 20 comments

Github Flavored Markdown has a nice syntax for tables, but the app does not support it.

Example

Centered Left aligned Right aligned Not aligned
cell cell cell cell
cell cell cell cell
cell cell cell cell

eush77 avatar Feb 05 '15 15:02 eush77

Looks like updating showdown and adding the github and table extensions will do the trick. I'll look into it.

maniac103 avatar May 25 '15 08:05 maniac103

Thinking about it, that will likely only help for watching markdown files though. For e.g. issues and issue comments, we're using preformatted HTML provided by Github. It's possible that Android's TextViews don't support showing tables though.

EDIT: That indeed is the problem. Gitskarios gets away with that by using a WebView for each comment and the description, but I'm not sure how this will perform on lower end phones and/or issues with a lot of comments.

maniac103 avatar May 25 '15 08:05 maniac103

Heyb

I used a webview to show the comments, but it get really really bad performance.

I switched to your Html > Textview way, but now i can't show tables neither.

Time ago, i made a plugin on Html.class, to manage the tables, i will find, apply to gitskarios, and try to make a PR.

alorma avatar May 25 '15 09:05 alorma

Thanks for the feedback, saves me from having to try it myself :)

maniac103 avatar May 25 '15 10:05 maniac103

Hey @maniac103 , i add you to a Private Repository, where i pushed the base class i did long time ago.

It's just the classes.

I will work on that and try to adapt with yours

alorma avatar May 25 '15 10:05 alorma

Thanks again :) It works, but needs some work: screenshot_2015-05-25-14-09-55

Most complicated part that I can see is getting the TextView width into the span, as I don't think the assumption that TextView width = screen width holds in all cases.

Are you in some IRC channel, Hangouts or something to discuss this?

maniac103 avatar May 25 '15 12:05 maniac103

Yes.

You can contact me by mail, is in my github profile

alorma avatar May 25 '15 12:05 alorma

Generally Markdown rendering should be improved.

julkue avatar Mar 12 '16 00:03 julkue

@maniac103 what's the status on this? Is the mentioned repository available somewhere?

Tunous avatar Apr 02 '17 18:04 Tunous

@Tunous I have a diff lying around somewhere. I'll see whether I can dig it up. In general, the problem is that we need to render the table in one span, and I'm not sure what the best way of creating a span that fills the whole TextView width is.

maniac103 avatar Apr 02 '17 18:04 maniac103

Got the diff and now that I look at it I think it might be a better idea to try a different solution. There are just too many factors in play and with limited width the tables will mostly just not fit. Or if we do text wrapping they will look off.

The solution I propose would be to change tables to clickable links that open a pop-up with the table in WebView instead. I saw it done like this somewhere but can't remember where now. It's not an ideal solution but it should be easy to add and will work much better than TextView span.

Tunous avatar Apr 02 '17 21:04 Tunous

I found a library that implements something similar to what I described: https://github.com/SufficientlySecure/html-textview#support-for-html-tables

peek 2017-04-13 21-08

Tunous avatar Apr 13 '17 19:04 Tunous

For now, a line break after each row and a space between cells would already help.

Crissov avatar Aug 02 '17 20:08 Crissov

I have found a way to implement this. See this repository with proof of concept implementation. You can compile and run sample app from here.

It's done by parsing comment HTML and splitting it into multiple blocks. Then each of these blocks gets its own view (HorizontalScrollView, TableLayout) based on its tag (table, pre). It works surprisingly well and just has one limitation where HTML code must be flattened to work correctly. (Though that probably could be fixed if needed)

@maniac103

Tunous avatar Oct 28 '17 20:10 Tunous

Managed to get it to compile. Here is how it looks for this comment:

markdown

Tunous avatar Oct 30 '17 14:10 Tunous

Glad this has been pointed out. Hope it gets implemented soon. Looks like it has been a few years since someone has commented.

Edit: Here is what table looks like on my system (OctoDroid v4.6.5):

Screenshot_20210622-010533_OctoDroid

Here is what it looks like in browser:

Screenshot_20210622-010543_Chrome

AntumDeluge avatar Jun 22 '21 08:06 AntumDeluge

Hello, any news on this ? Thanks

KaKi87 avatar Aug 27 '21 18:08 KaKi87

I think it works now

Secret-chest avatar Aug 19 '23 05:08 Secret-chest

Nope, not working on v4.6.10

KaKi87 avatar Aug 19 '23 05:08 KaKi87

At least it exists, not very correct but still readable

Secret-chest avatar Aug 19 '23 06:08 Secret-chest