text: `<pre>` is drawn as a paragraph in the body font, not as code
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start with crates/base/src/text/format/html.rs, especially the BLOCK_ELEMENTS handling, the inline code mark, and the tests that currently expect <pre> to become a paragraph. Compare that path with how fenced code blocks receive monospace styling, then update the <pre> behavior and its tests. Done when <pre> text renders in a monospace font with spacing preserved and the relevant tests pass.
Written by the indexing model from the issue text.
Description
Description
An HTML <pre> block is drawn as a paragraph in the body's proportional font, with no code block box. Its lines and spaces are kept (#3570, #3581), but text lined up with spaces no longer lines up. The HTML standard has <pre> drawn in a monospace font (pre { font-family: monospace; white-space: pre } in its rendering section), as gpui-kit draws a fenced code block.
The cause is in crates/base/src/text/format/html.rs. main has the same code.
preis one of theBLOCK_ELEMENTS(L48) and takes the path for any block element, which makes paragraphs of its text (L658-L683).- The HTML minifier keeps
<pre>'s white space (html5minify/mod.rs L741-L743), so the lines are kept, but nothing gives them a monospace font. <pre><code>…</code></pre>takes inline code's mark (L410-L412), not a code block.- The tests expect a
<pre>to be a paragraph (L815-L817, L845-L847).
Environment
- GPUI: gpui-pre 0.3.10 (the example's default, for the screenshot)
- GPUI Component: gpui-kit 0.8.1 (v0.8.1, 99576db)
- Platform: macOS 27.0.1 (arm64). The code is not platform-specific.
Steps to Reproduce
-
At v0.8.1, run
cargo run -p example-markdown. -
Replace the editor's text with this:
<pre> name size a.txt 12 b.txt 3456 </pre>
Expected
The text is in a monospace font, its columns lined up, as in a fenced code block.
The same Markdown as CommonMark's HTML, in Chrome 156 at the preview's width (624px) and text size (16px):

Actual
The text is in the body font with no box, and the numbers do not line up under "size".
The Markdown in step 2 in the example's preview:

- Dominant language
- Rust
- Stars
- 18.9k
- Forks
- 1.2k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 266
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from longbridge/gpui-kit
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
longbridge/gpui-kit#3795 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
longbridge/gpui-kit#3735 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
longbridge/gpui-kit#3630 ·
Maintainers usually reply within 1 day
-
input: allow Editor as the control of an InputGroupMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
longbridge/gpui-kit#3620 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
longbridge/gpui-kit#3612 ·
Maintainers usually reply within 1 day
All issues in longbridge/gpui-kit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
madesroches/fontaine#513 ·
Maintainers usually reply within 1 day
-
area:ui needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bherbruck/solvecraft#13497 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
needs-triage tooling
Difficulty 1/5 Under an hour Newbie friendliness 90/100
neilsh/stunt-reel#317 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
storytold/craft-fonts#65 ·
Maintainers usually reply within 2 days