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 Unintended MathJax in post previews on list pages such as question list, search results, and questions on tag pages

Parent

Unintended MathJax in post previews on list pages such as question list, search results, and questions on tag pages

+1
−2

Trichoplax points out that on Mathematics, having MathJax available on list pages is desirable, but for Software Development, it occasionally leads to hijinks.

What should be done?

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

1 comment thread

I don't know what a "list page" is supposed to be. (3 comments)
Post
+1
−0

Only the list page previews need fixing

I have explained the underlying causes in another answer. This answer proposes a general solution for all communities.

There will rarely be a problem in a post. For all of the Codidact communities that have MathJax enabled, nearly all usages of escaped square brackets and escaped parentheses will be either inside code blocks (where MathJax is not rendered) or inside intended MathJax. The only reason that the example question is rendered incorrectly in preview is that code blocks are suppressed in post previews (for example, on the question list page, search results, or the questions listed on a tag page).

Allow Markdown and codeblocks in post previews

If the regex in the example question is allowed to be rendered as a code block in the post preview then the escaped square brackets will not trigger MathJax rendering.

Truncate post previews by height rather than character count

Currently a post preview is limited to a certain number of characters.

Allowing Markdown and code blocks in post previews could cause incorrect rendering in cases where the limited number of characters in the preview results in a section of Markdown formatting being opened but not being closed. For example, if the opening and closing asterisks of a bold section are both included, the preview would correctly show bold:

A preview of a post with **some bold text**.

would be rendered as:

A preview of a post with some bold text.

However,

A preview of a post with **some bold t...

would be rendered as:

A preview of a post with **some bold t...

The opening ** is rendered as raw text because it lacks a closing **.

This could be completely avoided by including the full text of the post and displaying only the first few lines. Alternatively, this could be mostly avoided by including a limited section of the full text and displaying only the first few lines. This second option is a compromise between including all of the text (which ensures the closing symbol is always included for each opening symbol) and keeping the network request size of the list page small. The more text is provided, the lower the probability of an opening symbol being included in the visible section for which the corresponding closing symbol is not included in the provided text.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

There are no post previews on Mathematics Codidact (1 comment)
There are no post previews on Mathematics Codidact
trichoplax‭ wrote 1 day ago

There is no need for this fix for Mathematics Codidact as none of the list pages there show a preview of the post body, only the title.