Skip to content

feat: let mods show html in a markdown TextView as text with raw_html(false) - #1073

Open
aetoskevin wants to merge 1 commit into
herdrdev:masterfrom
aetoskevin:text-view-raw-html-option
Open

aetoskevin wants to merge 1 commit into
herdrdev:masterfrom
aetoskevin:text-view-raw-html-option

Conversation

@aetoskevin

Copy link
Copy Markdown

Fixes #1071.

A mod can now write TextView.markdown(id, text).raw_html(false) to show any HTML in the Markdown as the text it is written as. Autolinks stay links, and the default is unchanged.

  • vendor/gpui-kit/crates/base: backports gpui-kit text: Add an option to keep raw HTML in Markdown as text longbridge/gpui-kit#3979 (MarkdownExtensions::raw_html, TextView::markdown_raw_html and its test), marked HERDR:. It's reviewed there and not yet merged; once herdr-app's vendored gpui-kit includes it, this backport goes away.
  • vendor/gpui-kit/crates/shell:
    • a raw_html behavior, registered where selectable and scrollable are;
    • applied as markdown_raw_html when the TextView is built;
    • declared on TextViewElement in the generated .d.ts.
  • defaults/AGENTS.md: one line on .raw_html(false).

Tests:

  • the typings test checks that raw_html( is declared on TextViewElement only;
  • the render test checks that the behavior is recorded (:raw_html);
  • the vendored gpui-base test covers the parser.

How it was tested (macOS 26.6.2 ARM64), running the vendored crates' tests resolved through Herdr's Cargo.lock and patches:

  • gpui-base's new test passes, along with all 1329 of its unit tests. The vendored unit tests need gpui-kit's README.md, which a test reads with include_str! and which isn't vendored, so I put it in place for the run.
  • In gpui-shell, the text_view and typings tests pass.
  • gpui-shell's lib suite gives the same results with and without this change: 702 pass, and the same 5 fail on master (5216e6f) without it, among them typings::tests::every_element_method_is_accounted_for (3208 declared style methods against 3207 in the runtime's table).
  • herdr-app's own cargo test --locked passes (Rust 1.100.0, Zig 0.16.0). It doesn't run the vendored crates' tests, because the workspace excludes vendor/gpui-kit; hence the runs above.

Written with AI (Claude).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextView.markdown can't show HTML in Markdown as text

1 participant