Summary
Three small polish fixes to the spec UI noticed while browsing the section:
- The spec list preview was just collapsing whitespace, so the raw markdown of the body (headings, fenced code blocks, inline backticks) was leaking into the table cell. Added a
strip_markdown/1 pass before truncating so the preview reads as plain prose. Intraword underscores are preserved so identifiers like Tuist.Namespace.create_instance_with_ssh_connection/1 survive.
- Inline
<code> in the spec body and comment body now uses the Noora prose treatment from ../tuist/server/assets/shared/css/prose.css: a subtle 3-layer box-shadow plus --noora-radius-2 over surface-background-secondary, instead of the flat tertiary pill.
- Code blocks (
<pre>) get the matching elevated chrome (same shadow stack, --noora-radius-4, no border) and !important on the background so MDEx’s inline background-color from the github_light theme can’t override it. When a fence language is set the highlighted tokens now read against a consistent backdrop; when not, the block at least looks intentional.
Context
A couple of approaches were considered for the preview strip:
- Render the body to HTML through MDEx and strip tags. Correct but heavy for every row of the table.
- A small regex pass. Cheap, covers the common cases the user actually sees (headings, fences, backticks, list markers, links, emphasis). Picked this.
The first attempt at the regex also stripped _ as an emphasis marker, which mangled function arities. CommonMark treats intraword underscores as literal, so the underscore branch was dropped and only * / ~~ are stripped now. A regression test pins this down.
A code-window-style wrapper with a language bar (like the marketing site uses) was considered but skipped: it requires touching the markdown pipeline and the user did not ask for it. Worth a follow-up if syntax highlighting becomes a bigger deal for spec bodies, alongside a default_lang for fences that omit one.
Testing
mix test test/hive_web/live/spec_live/ test/hive/specs_test.exs — 33 tests, 0 failures
mix compile --warnings-as-errors
mix format --check-formatted on the touched files
mix credo lib/hive_web/components/spec_components.ex
- Visual check pending in the running app