Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

<code> blocks

Featured Replies

I obviously spent too much time using Mattermost. To my shock the HTML inside

<code>

tags is rendered.

Is there any nice script that get rids of rendering and adds proper indentation, or do all instructor websites really make their code blocks manually?

Thanks for your help!

Not quite sure what you mean. Can you give an example.

There are a number or alternatives you can use, I prefer <pre>. But in all cases if you want it to look pretty on the page it needs formatting.

Have you looked at the specification for <code>?

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/code

 

  • 7 months later...

You’re not alone—many platforms handle <code> blocks differently.

In most modern websites, code blocks are not written manually. They use tools or libraries that prevent HTML rendering and add formatting automatically, such as:

  • Markdown parsers (Markdown escapes HTML inside code blocks by default)

  • Syntax highlighters like Prism.js or Highlight.js

  • Server-side escaping (&lt;, &gt;, &amp;) to stop HTML rendering

If your platform renders HTML inside <code> tags, it likely isn’t escaping content properly. A common fix is to wrap code in pre + code and escape HTML, or use a Markdown-based editor.

For instructors/sites, the best practice is using Markdown + a syntax highlighting library, not manual formatting. This keeps code readable, safe, and consistently indented.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.