inline <code> tags get turned into block-level elements

Created on 9 January 2022, over 3 years ago
Updated 28 April 2024, over 1 year ago

Problem/Motivation

The HMTL CODE tag is an inline block element, which means you can do things like $myvar within a paragraph.

However, this module's CSS sets display:block on the CODE elements it processes, which breaks formatting.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom joachim

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • 🇨🇦Canada mandclu

    Not sure if CKEditor 5 handles pre tags differently, but I'm not able to make the pre tags appear inline. I edited the source in my content so the pre tags would be inside a paragraph, but as soon as I take it out of source code view, the WYSIWYG has put paragraph tags around the pre tags again.

  • Status changed to Needs review over 1 year ago
  • 🇨🇦Canada mandclu

    I found a pretty simple way to make this work the way I would have expected: change the XPath query within highlight_php_highlight() to only select code tags that are directly within pre tags. Since this aligns with how Drupal core marks up "code blocks", this makes sense as a solution.

Production build 0.71.5 2024