gdcc / dataverse-previewers

A collection of Datafile Previewers that can be configured to work with Dataverse
MIT License
5 stars 15 forks source link

Tables in Markdown previewer #71

Open philippconzett opened 2 months ago

philippconzett commented 2 months ago

I've been testing file previewers v1.4 in our Dataverse test environment (v6.2). When opening a Markdown file (.md) in the Markdown previewer, tables are not displayed as tables but as plain text. The tables look fine in Markdown editors, e.g., https://stackedit.io/app#. Maybe there is a bug in the previewer? Thanks for considering this input!

pdurbin commented 1 month ago

Hmm, tables are non-standard in Markdown so I'm not super surprised they don't "just work".

@philippconzett which table syntax are you using?

@ErykKul added the Markdown previewer in #23 and might know offhand if tables are supported.

philippconzett commented 1 month ago

Ah, thanks, @pdurbin, I didn't know. If I remember correctly, I the file I previewed had a table like this:

Row1 Row2 Row3 Row4 Row4
Cell1 Cell2 Cell3 Cell4 Cell5
Cell6 Cell7 Cell8 Cell9 Cell10
gwendoux commented 1 month ago

Markdown is a markup language of fairly limited design (intended by creator Daring Fireball's Gruber). We're used to using markdowns, extended versions such as Github's flavor, which have implemented quite a few functions. The dataverse previewer seems to use a standard implementation.

ErykKul commented 1 month ago

I made a PR to add support for tables. They do not look very good, but it works (tested on our pilot env with a README.md from GitHub):

image

ErykKul commented 1 month ago

After merging to master all previewers are auto-updated, e.g.:

git cherry-pick 86ddd14b2b4393f5ff053e68a43fab811740d817 8ca549dd9ea1147438692ac6866a9013a3419381
pdurbin commented 1 month ago

@ErykKul seems like a good fix to me! @philippconzett @gwendoux what do you think?

philippconzett commented 1 month ago

Looks good to me. Thanks for fixing this!

gwendoux commented 1 month ago

It's good enough👍. A simple tweak on the css part could fix the "looks good" later ;)

gwendoux commented 1 month ago

@ErykKul Here is a good source for replicating GitHub Markdown style https://github.com/sindresorhus/github-markdown-css