codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
385 stars 68 forks source link

Editor and rendered post show tables different (yet another clash of the renderers) #1302

Closed cellio closed 8 months ago

cellio commented 8 months ago

meta:289970

We use different libraries to render markdown client-side (for editing) and server-side (stored HTML). I looked for an open bug about this but didn't find one, so...

Per the linked meta post, table rendering differs between these two views; the editor shows alignment like in the following example:

Default | Left | Centre | Right
------- | :--- | :----: | ----:
1       | 2    | 3      | 4
5       | 6    | 7      | 8

But the final post does not; all cells are left-aligned.

If we can't make them do the same thing (which I assume is hard), would it be possible to detect column alignment syntax and warn, like we do for unsupported HTML? I know we're kind of playing whack-a-mole with these diffs; I'm looking for a way to reduce user surprise, not necessarily for us to fix every difference.

MoshiKoi commented 8 months ago

With the new post validation notice, I see this:

image

The post validator seems to have been corrected at some point (the preview no longer aligns entries, matching the final version) and with the new notice, users are able to see why it doesn't have alignment.

cellio commented 8 months ago

Ah, you're right! I guess my dev branch wasn't up to date when I tested this, oops.