# markdown: Add support for \`HTML\` styling attributes \(\#42143\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/9591790d8df9d97f0fa2aa9901113bc9bdc560be)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 9591790d8df9d97f0fa2aa9901113bc9bdc560be

Requested commit: 9591790d8df9d97f0fa2aa9901113bc9bdc560be

Commit: 9591790d8df9d97f0fa2aa9901113bc9bdc560be

Tree: f35a0d662de1ee02bda0f1d5ae72d6be14efd72e

Author: Remco Smits

Committer: GitHub

## Message

````
markdown: Add support for `HTML` styling attributes (#42143)

Second take on https://github.com/zed-industries/zed/pull/37765.

This PR adds support for styling elements (**b**, **strong**, **em**,
**i**, **ins**, **del**), but also allow you to show the styling text
inline with the current text.
This is done by appending all the up-following text into one text chunk
and merge the highlights from both of them into the already existing
chunk. If there does not exist a text chunk, we will create one and the
next iteration we will use that one to store all the information on.

**Before**
<img width="483" height="692" alt="Screenshot 2025-11-06 at 22 08 09"
src="https://github.com/user-attachments/assets/6158fd3b-066c-4abe-9f8e-bcafae85392e"
/>

**After**
<img width="868" height="300" alt="Screenshot 2025-11-06 at 22 08 21"
src="https://github.com/user-attachments/assets/4d5a7a33-d31c-4514-91c8-2b2a2ff43e0e"
/>

**Code example**
```html
<p>some text <b>bold text</b></p>
<p>some text <strong>strong text</strong></p>
<p>some text <i>italic text</i></p>
<p>some text <em>emphasized text</em></p>
<p>some text <del>delete text</del></p>
<p>some text <ins>insert text</ins></p>

<p>Some text <strong>strong text</strong> more text <b>bold text</b> more text <i>italic text</i> more text <em>emphasized text</em> more text <del>deleted text</del> more text <ins>inserted text</ins></p>

<p><a href="https://example.com">Link Text</a></p>

<p style="text-decoration: underline;">text styled from style attribute</p>
```

cc @bennetbo 

**TODO**
- [x] add tests for styling nested text that should result in one merge

Release Notes:

- Markdown Preview: Added support for `HTML` styling elements

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
````

## Parents

- [74bf1a170d44e62140e2d6537c716d02f7fd71c5](https://git.cafe/gitcafe/zed/commit/74bf1a170d44e62140e2d6537c716d02f7fd71c5?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/9591790d8df9d97f0fa2aa9901113bc9bdc560be?format=markdown)
