1

I stumbled across this question which has some peculiar formatting in the code block.

image of code block in question

I noticed that some of the text within the code block was italicized, which I was under the impression could not be done (with asterisks anyway) within a code block.

Unfortunately it doesn't seem to work the same on this site, so I can't create a similar code block to demonstrate here.

I opened the edit screen on the linked question to see what was going on, and weirdly enough the text was not italicized in the edit preview.

enter image description here

This only seems to happen with code blocks that have been indented. Code blocks using fences seem to not italicize the text, which is what I would expect.

I have a funny feeling that this is not how this is supposed to work.

EDIT: The suggested duplicate does answer a portion of this question, but there is still a big question I addressed that is left unanswered.

Why does this not happen in the edit screen preview?

The answer on the suggested duplicate states

Note that the issue definitely is visible in the editor preview too, you just need to make sure you let the highlighter kick in (there is a few second delay after you stop editing).

This is clearly not the case (any more at least). No matter how long you wait, the text in the preview will never be italicized. To me, this alone means this is in fact a bug that can be fixed.

In fact, this bug probably should be fixed as it can negatively impact the question, especially when the question is about a regular expression such as this one.

Normally when you italicize text, you surround the text with asterisks (or underscores). When it gets rendered, the asterisks are not displayed and the text you put within them is italicized. Someone that has never seen this bug before (such as myself) could reasonably assume that this is also what's happening in this case. The notion that there could be extra, invisible asterisks (or underscores) in the regular expression is a huge deal because if this were the case, it could drastically change the result of the expression. This could deter them from answering the question entirely (not to mention the confusion it would cause if it were an answer), especially if they can't look at the edit screen (if the suggested edit queue is full and they don't have enough rep for edits to apply instantly) to see that this is, in fact, not the case.

6
  • 1
    @Ivar Not really, no. The linked question is tagged with support not bug, which I'm fairly certain this is. The question also doesn't address the fact that this does not happen within the edit preview and only happens on the main page. The answer on the linked question also implies that it is a problem with the library, not the site itself. This is clearly not the case given it doesn't happen on Meta or, again, the edit screen preview. If that question is talking about the same problem though, it's interesting that that's been around for over 2 years without a fix.
    – Jesse
    Commented Nov 11, 2022 at 0:55
  • 2
    Slight correction, the answer on the linked question does address the fact that it does not show up in the edit preview, but it also says "the issue definitely is visible in the editor preview too, you just need to make sure you let the highlighter kick in (there is a few second delay after you stop editing)". This is definitely not the case (any more, at least). No matter how long you wait, it does not appear italicized on the edit screen.
    – Jesse
    Commented Nov 11, 2022 at 1:15
  • 1
    When I tested it, the edit preview did show the italics. I don't know why it didn't for you. However, the issue should no longer occur for regex questions. For the regex tag, I've changed the assigned syntax highlighting language from "default" to "none", which should prevent the syntax highlighter from becoming confused and applying the Markdown highlighting by default, which was what was causing the code to appear in italics. Note that the linked question also was edited earlier to explicitly indicate lang-txt, which disabled syntax highlighting for that code block.
    – Makyen Mod
    Commented Nov 12, 2022 at 2:04
  • @Makyen Won't that screw up the highlighting for questions tagged with regex and another language?
    – khelwood
    Commented Nov 12, 2022 at 7:15
  • @khelwood It doesn't appear to when the other language has a highlighting language defined: JavaScript example; Python example. OTOH, I'd prefer to see no syntax highlighting rather than substantially wrong syntax highlighting that causes confusion.
    – Makyen Mod
    Commented Nov 12, 2022 at 12:34
  • @Makyen Interesting. I was playing around with the edit screen on that question for probably 10 minutes and couldn't get it to show in the preview. Anyway, thank you for fixing it.
    – Jesse
    Commented Nov 12, 2022 at 15:48

0

You must log in to answer this question.

Browse other questions tagged .