XML not visible in post

AI-generated summary

In a Support category thread titled ā€œXML not visible in post,ā€ Ivan_Rapekas reports that XML code in their post is invisible, sharing an example of the markup. codinghorror explains this is by design — Markdown interprets raw XML as illegal HTML unless wrapped in a code block. Ivan_Rapekas suggests a helpful warning during posting to remind users to use triple backticks for code. sam notes this is a significant issue but unlikely to be added to Discourse core, though it could be a plugin using complex regex or parsing. codinghorror adds that Stack Overflow does auto-detect code because the cost of not doing so on a programming site is too high, and this topic has been extensively discussed. sam closes the thread, referencing a meta topic on code formatting, reaffirming the behavior is intentional.

Hi, there is invisible XML block below.





























Here is the end of XML block.

This is by design, and how Markdown works.. put it in a code block unless you want it to be interpreted as illegal non-whitelisted html.

Though I expected this behavior, I would like to have a small warning during posting like this: ā€˜Your message contains a code, consider to put it in a code block using triple back quotes (unless …)’ :slight_smile:

This is a pretty enormous problem. I do not see Discourse core adding such a feature for ā€œautomatic code block missingā€ warning. Not sure if even Stack Overflow do this.

But … it is an interesting idea for a plugin, which would have to use some very fancy regex mountain or a custom parser of sorts.

This has been covered at EXTREME length in other topics about ā€œauto detecting code when a user can’t figure out how to properly format codeā€

And yes SO does do this, because the cost of not doing it on a site about programming was super high.

closing this as … by design and covered at: