-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
markdown: Add support for HTML styling attributes
#42143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
markdown: Add support for HTML styling attributes
#42143
Conversation
|
@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? |
|
I think the CI failure is expected, since the code is broken after merging main |
|
I thought I was already update to date, will fix it then. edit: Ahh the caption PR got merged. Got it now. |
|
@bennetbo Fixed your review comments. |
bennetbo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
…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>
…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>
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

After

Code example
cc @bennetbo
TODO
Release Notes:
HTMLstyling elements