Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network ‚Äď this is the site for you.

Comments on Markdown table alignment only renders correctly in preview

Parent

Markdown table alignment only renders correctly in preview

+5
−0

Codidact posts support Markdown tables.

For example, the following raw text:

Column 1 | Column 2
-------- | --------
Data A   | Data B
Data C   | Data D

renders as:

Column 1 Column 2
Data A Data B
Data C Data D

This works both in the edit preview and in the saved post.

However, alignment of data only works in the edit preview, and is ignored in the saved post.

For example, the following raw text:

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

renders as:

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

In the edit preview these are aligned as intended (start editing to see this correct preview), but in the saved post they all have default alignment.

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+2
−0

Column alignment in tables now produces a warning that it won't render in the final post (it's part of the "unrecognized HTML" warning). Also, the editor preview now shows the same formatting as the final post, with all columns left-aligned.

I'm sorry we couldn't fix it the other way, by supporting column alignment, but at least now the preview doesn't mislead you.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

Why not support it? (5 comments)
Why not support it?

Why not support it? Why cannot it be fixed?

I'll have to defer to the developers for a more detailed answer, but I believe we are using third-party libraries for Markdown support, not rolling our own.

Andreas from the dark caverns‭ wrote 2 months ago · edited 2 months ago

I guess I’ll find an answer by looking through the chat on the dev server, as I’ve seen something about this topic pop up there.

trichoplax‭ wrote 2 months ago

I'm not familiar with the process, but the end result appears to be HTML for an aligned table, so it may be that the Markdown library is already outputting the required HTML, and that the only obstacle is that we do not yet support that HTML.

Every so often new elements and attributes are added to the list we support. It might just be a matter of deciding it's acceptable and adding it to the list.

trichoplax‭ wrote 2 months ago

If we don't want to support the style attribute in general, we could possibly add more specific allowed styles. Maybe just the ones for table alignment. I don't know how practical that would be - just wondering.