slapperwan / gh4a

Github client for Android
Apache License 2.0
1.73k stars 221 forks source link

Add support for GFM tables #237

Open eush77 opened 9 years ago

eush77 commented 9 years ago

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
maniac103 commented 9 years ago

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

maniac103 commented 9 years ago

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.

alorma commented 9 years ago

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.

maniac103 commented 9 years ago

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

alorma commented 9 years ago

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

maniac103 commented 9 years ago

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?

alorma commented 9 years ago

Yes.

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

julkue commented 8 years ago

Generally Markdown rendering should be improved.

Tunous commented 7 years ago

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

maniac103 commented 7 years ago

@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.

Tunous commented 7 years ago

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 commented 7 years ago

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

Crissov commented 7 years ago

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

Tunous commented 7 years ago

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 commented 7 years ago

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

markdown

AntumDeluge commented 3 years ago

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

KaKi87 commented 3 years ago

Hello, any news on this ? Thanks

Secret-chest commented 1 year ago

I think it works now

KaKi87 commented 1 year ago

Nope, not working on v4.6.10

Secret-chest commented 1 year ago

At least it exists, not very correct but still readable