# Inline formatting used when "preformatted text" formatting applied to multi-line selection

**URL:** https://meta.discourse.org/t/inline-formatting-used-when-preformatted-text-formatting-applied-to-multi-line-selection/378678
**Category:** Bug
**Tags:** composer
**Created:** [August 15, 2025, 2:04am UTC](https://meta.discourse.org/t/inline-formatting-used-when-preformatted-text-formatting-applied-to-multi-line-selection/378678 "2025-08-15T02:04:38Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![per1234](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/per1234/32/569645_2.png) [@per1234](https://meta.discourse.org/u/per1234)
#### Post date: [August 15, 2025, 2:04am UTC](https://meta.discourse.org/t/inline-formatting-used-when-preformatted-text-formatting-applied-to-multi-line-selection/378678/1 "2025-08-15T02:04:38Z")

</div>

### Priority/Severity:

Medium

### Platform

#### Operating System

Windows 11

#### Browser

Google Chrome 139.0.7258.67

#### Discourse

`dee24bd73b158ba97453f20035eabce430a1abcd`

### Description:

There are two styles of “preformatted text” formatting:

- inline: for use with non-prose content within a prose passage (e.g., “call the `foo` function”), or a single short line of non-prose content.
- block: for use with multiple lines of non-prose content

The user may take either of two approaches to applying formatting when using the composer:

- proactive: the formatting mode is toggled prior to adding the content to be formatted
- retroactive: the content is added in unformatted form, then selected and formatting applied to that selection

🐛 When using the composer in the “rich text editor” mode, applying “preformatted text” formatting retroactively when multiple lines are selected applies the inline style. This results in the post being difficult to read and the non-prose content being difficult to copy (a common requirement for shared code).

### Reproducible steps:

1. Open the composer.

2. Place the editor mode switch in the “rich text editor” position.

3. Add the following content to the post:

4. Select the post content.

5. Click the **\</\>** button on the composer toolbar.

🐛 Each of the selected lines was formatted individually in the inline style:

`void setup() {`

` // put your setup code here, to run once:`

`}`

`void loop() {`

` // put your main code here, to run repeatedly:`

`}`

The correct behavior would have been to put the content in a single code block:

```plaintext
void setup() {

  // put your setup code here, to run once:

}

void loop() {

  // put your main code here, to run repeatedly:

}

```

### Additional context

The Markdown editor has the correct behavior of placing the selected content in a code block when “preformatted text” formatting is applied retroactively to a multi-line selection.

* * *

I am able to reproduce the fault on [try.discourse.org](http://try.discourse.org) in “[safe mode](https://meta.discourse.org/t/how-to-use-discourse-safe-mode/53504)”.

---

_[View the full topic](https://meta.discourse.org/t/inline-formatting-used-when-preformatted-text-formatting-applied-to-multi-line-selection/378678)._
