How to get content of <code> tag highlighted?

Created on 19 April 2018, over 6 years ago
Updated 23 May 2023, over 1 year ago

Everything works ok with <?php tag, however when you use just <code> tag then it has only grey background without highlighting, because apparently it is rendered so according to HTML-code of the page.

To replicate the issue:

1. Install vanilla Drupal 7.
2. Install and configure the module per instructions on https://www.drupal.org/node/613054 β†’ .
3. Paste the following code:

<h2>Example HTML heading</h2>

and you will get:

<code><h2>Example HTML heading</h2></code>

as rendered HTML. However, if you view the HTML-code here on drupal.org the same code is parsed as:

<code class=" language-php"><span class="token markup"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>h2</span><span class="token punctuation"></span></span></span>Example <span class="token constant">HTML</span> heading<span class="token markup"><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h2</span><span class="token punctuation"></span></span></span></code>

So I can't figure out why it works differently on my fresh setup. Is it because D.O. uses some kind of modified version? How could I set PHP as the default language for any </code> tag content?

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Support

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024