مشكلة في تنسيق كتلة الشفرة في Discourse – النص الأحمر والتسليط الضوئي غير المقصود

Isn’t that exactly what it looks like in your Discourse image? (Except in your editor import and as are bold)

Hi Alex,
I think @Moin has the right idea–I’m seeing some styling applied to the code blocks that looks like it’s probably coming from Custom CSS/HTML in the theme.

I think this line (font-family: Consolas;) could be safely removed since it’s overriding these existing styles which use the same font but also specify fallback options:

code, pre {
    font-family: var(--d-font-family--monospace);
}

:root {
    --d-font-family--monospace: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace;
}

Maybe your computer isn’t able to display Consolas and is just falling back to the default (non-monospace) font. You can check here to see if that CSS is present:

إعجاب واحد (1)

Ah, I also just noticed we do have an official theme component for customizing code block appearance:

I think this was likely the issue but I didn’t verify. I ended up switching themes and it resolved the issue. Thanks, everyone, for your input! And thank you again, Bryce, for finding the theme component for customizing code block appearance.

إعجاب واحد (1)