charmbracelet / glamour

Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️
MIT License
2.38k stars 175 forks source link

Odd rendering of table #60

Closed mathomp4 closed 1 month ago

mathomp4 commented 4 years ago

All,

First let me say I do love glow. Just learned about it recently and it's one less reason I don't need to spawn a browser when editing Markdown (which I'm still learning).

However, I noticed that for some reason a table of mine is rendering...oddly. And I don't know why. The file in question is this README.md. When I run it through glow, the entries for three of the rows have odd/different justification:

Screen Shot 2020-01-12 at 1 45 52 PM

I tried looking in vim with :set list on, but I don't see any odd characters in those rows. Any ideas on what I might have done?

muesli commented 4 years ago

It identifies 2.6, 2.20 and 1.16 as valid numbers, whereas all the other entries are considered strings. We will have to fix the table alignment.

meowgorithm commented 4 years ago

To elaborate on @muesli’s comment, numbers align right by default, the same way they would in a spreadsheet. This is a great example of why that isn't always ideal!

mathomp4 commented 4 years ago

Ohhh. I see it. The others are all two-dot semver versions or just plain ol' strings. It's not like it hurts anything, but it just struck me as odd. :smile:

arl commented 3 years ago

87 Hello there, great package here.

Is there an ETA for fixing this? I could help if that's something you'd like to see fix soon. I know I would :-)

muesli commented 3 years ago

I'm afraid I still haven't looked into it, so no ETA at this point. Help is always appreciated though!

muesli commented 3 years ago

To elaborate a bit more: currently we let the table renderer automatically detect column alignments, which is probably causing this issue. I think we should try to tackle this along with #65 and stick to a fixed alignment as specified in the markdown's table header.

arl commented 3 years ago

Sounds great. Yes a fixed alignment would fix that. Later it could be improved with adding support to different alignments but for now, sticking with a consistent alignment, whatever it is, would do the trick.