Skip to content

Conversation

@RemcoSmitsDev
Copy link
Contributor

@RemcoSmitsDev RemcoSmitsDev commented Nov 6, 2025

Second take on #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
Screenshot 2025-11-06 at 22 08 09

After
Screenshot 2025-11-06 at 22 08 21

Code example

<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

  • add tests for styling nested text that should result in one merge

Release Notes:

  • Markdown Preview: Added support for HTML styling elements
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 6, 2025
@github-actions github-actions bot added the community champion Issues filed by our amazing community champions! 🫶 label Nov 6, 2025
@RemcoSmitsDev RemcoSmitsDev marked this pull request as ready for review November 7, 2025 14:40
@RemcoSmitsDev
Copy link
Contributor Author

@bennetbo It looks like CI uses a stale version of the cache, that's why it's failing. Could you clear the cache and restart it?
The PR should be fine after it, and ready for your review.

@bennetbo
Copy link
Member

bennetbo commented Nov 7, 2025

I think the CI failure is expected, since the code is broken after merging main

@RemcoSmitsDev
Copy link
Contributor Author

RemcoSmitsDev commented Nov 7, 2025

I thought I was already update to date, will fix it then.

edit: Ahh the caption PR got merged. Got it now.

@RemcoSmitsDev
Copy link
Contributor Author

@bennetbo Fixed your review comments.

Copy link
Member

@bennetbo bennetbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@bennetbo bennetbo enabled auto-merge (squash) November 7, 2025 16:08
@bennetbo bennetbo merged commit 9591790 into zed-industries:main Nov 7, 2025
24 checks passed
tomatitito pushed a commit to tomatitito/zed that referenced this pull request Nov 7, 2025
…2143)

Second take on zed-industries#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>
@RemcoSmitsDev RemcoSmitsDev deleted the markdown-styling-support-v2 branch November 8, 2025 13:34
11happy pushed a commit to 11happy/zed that referenced this pull request Dec 1, 2025
…2143)

Second take on zed-industries#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion Issues filed by our amazing community champions! 🫶

2 participants