# markdown: Add HTML \`table\` element support \(\#38605\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 46b6adadf908fd673d2f37d83c9247b44bc81465

Requested commit: 46b6adadf908fd673d2f37d83c9247b44bc81465

Commit: 46b6adadf908fd673d2f37d83c9247b44bc81465

Tree: b64b3532ba07fe15d002fab9a7c21bd221fd7106

Author: Remco Smits

Committer: GitHub

## Message

```
markdown: Add HTML `table` element support (#38605)

Follow-up: https://github.com/zed-industries/zed/pull/38590

**Note**: this PR contains changes from the [previous
PR](https://github.com/zed-industries/zed/pull/38590), when that PR gets
merged we should see the real changes.
This PR fixes 4 things in order to make:

1. Add html/markdown minifier to remove all the **\t** and **\n**
characters. This is needed as you cannot create new lines with markdown
by just adding an enter to the source file.
2. The event Event::HTML only contained a chunk of the real html for
multiline HTML code. I fixed this by storing the currently watched HTML
inside a buffer and at the end we parse it into the right elements.
Instead of trying to parse a chunck into multiple elements which would
always fail before.
3. Add support for html tables.
4. Fixed panic that occured when table does not have an header.

I also decided to keep the html minifier inside Zed, because making it a
dependency for just a few 100 lines seems to be an overkill. The
original crate had a few cve in their dependencies, so figured this
would be the best.

**Html table support**
<img width="1439" height="801" alt="Screenshot 2025-09-27 at 12 19 07"
src="https://github.com/user-attachments/assets/a884cc6f-cf47-45a2-81fa-91300c7bbf3f"
/>

**Before & after Zed's README (no changes)**
<img width="3440" height="1378" alt="Screenshot 2025-09-27 at 12 34 47"
src="https://github.com/user-attachments/assets/1273b094-fb24-4abd-bffa-56ef3b44670c"
/>

Release Notes:

- Markdown: Added support for html tables
```

## Parents

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

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