Repository navigation
Markdown widget in a new eggshell-ui-extras crate (#254, #134) - #268
Merged
Merged
Conversation
Apps (the docs site first) need to show Markdown as eggshell nodes. The new `eggshell-ui-extras` crate holds composites written on the public API alone; each widget is an opt-in feature, and `markdown` brings pulldown-cmark. - Two stages. `parse` walks pulldown-cmark's events with a container stack into blocks whose text is `Spans` (#249); `build` turns blocks into nodes. The parse is cached in egui's FrameCache keyed by the source: the blocks are a function of the source alone, as links, directives and style apply at build. - `b.markdown(key, src).on_link(..).directives(®).add()`, through the `MarkdownExt` trait. External links open; internal ones go to on_link. A fence whose first info word names a registered directive mounts it in place of the code. - Headings are keyed by their GitHub-style anchor; `headings(src)` lists them for an outline. Lists are (marker, content) rows with painted markers (disc, circle, square, task box) and numbers; quotes are a bordered column; code is a monospace block; images load through egui's loaders at their texture size. Tables and HTML show their source in a labelled box; disabled extensions read as their text. - `MarkdownStyle` (extras) defaults from core's `Style`; the shadcn crate's new `extras` feature fills it from tokens on `apply`. - examples/markdown.rs is the test page, with light/dark goldens. - The text-test helpers (galley_of, part_rect, section_of, opened_urls) move into tests/it/support for both suites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKf74MNWrhkW1CvKVUP
Owner
Author
|
Manual trial (user, 2026-11-15): the internal link doesn't seem to do anything; otherwise it looks good, apart from tables (waiting on #20). |
Owner
Author
|
Gate (my run, the branch merged with current main): |
The trial found the test page's internal link did nothing: on_link got "#lists" and the page only recorded it. Following an anchor within the document is the widget's job, as it is a browser's, and only the widget knows its headings' node ids (they sit under its private keys, nested in quotes and lists). So the widget now records each heading's id as it builds, and a link "#anchor" naming one of them scrolls every container holding it to put the heading at the top (Shell::scroll_into_view, Align::Min). Other links go to on_link as before; external ones still open. Behavior change: an anchor that names a heading in the document is no longer passed to on_link. One naming no heading still is. The test page's sentence now has an internal link to "#directives" (far enough down to scroll), a relative link "guide.md" that the status line shows, and the external link; the goldens change in that line only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKf74MNWrhkW1CvKVUP
Owner
Author
|
Gate (my run on the fixed head, merged with main): |
This was referenced Nov 16, 2026
The library must not panic in any build (#279). - The document's top-level blocks are the walk's own list, not a Root on the container stack, so "the root is never closed" holds by construction and its expect and unreachable!s are gone. - pulldown-cmark balances what it opens; should it not, a close with nothing open is ignored, an item outside a list keeps its blocks, and containers still open at the end are closed (TODO(#279) to report). Tested by feeding the walk unbalanced events. - Emphasis and strong counts saturate; an ordered list's numbers saturate. - A table or HTML block's source is read with `get`. - Heading styles are destructured by level and the bullet shape is a match, not runtime indexing. Nothing drawn changes; no golden moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKf74MNWrhkW1CvKVUP
5 tasks
samitbasu
added a commit
that referenced
this pull request
Nov 16, 2026
No textual conflicts. The new table (src/owned/table.rs) called the old `div_id_with(id, key, ..)`; it now passes a Slot (the row's own, and `slot_of` for each cell's id), so a repeated key there gets its own id like everywhere else. The merged code adds no debug-misuse panics in WP1's scope (the markdown builder's `shell()` is the builder's, which cannot panic). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Markdown widget, in the new
eggshell-ui-extrascrate. Stacked on #264 (rich text, #249): the base isrichtext-249; once #264 merges I'll merge main in and retarget tomain.Crate (#134)
crates/eggshell-ui-extras(eggshell_ui_extras), on eggshell-ui's public API only. Widgets are opt-in features;markdownbringspulldown-cmark(no default features).eggshell-ui-shadcngains an optionalextrasfeature that fills the extras' styles from its tokens; extras never depends on shadcn.API
MarkdownStyle::from_style(&Style),MarkdownStyle::of(ctx),install_for(ctx, theme); shadcn:Shadcn::markdown(&Style), installed byapplyunderextras.Shape
Spans, text of one style merged into one span. Headings get GitHub-style anchors (an explicit{#id}wins; duplicates get-1,-2). Images are inline in Markdown and blocks here, splitting their paragraph.FrameCachein the context's memory, keyed by the source. Sound because blocks are a function of the source alone; links, directives and style are applied at build (stated in a comment). Agreed with the coordinator instead of per-layout state.b.spans; a heading isb.spanskeyed by its anchor (ids survive edits above); a list is (marker, content) rows; a quote is a column with a left border; a code fence is a monospace block, or a mounted directive when its first info word is registered; an image loads through egui's loaders and shows at its texture size (alt text while pending, a "not shown" box on error);---is a rule.Visual defaults (the user's to revisit)
After shadcn/ui's typography page:
text-4xl36/40 bold (shadcn: extrabold, whichWeightlacks); h2text-3xl30/36 semibold withborder-b pb-2; h3 24/32, h4 20/28 semibold; h5 18/28, h6 16/24 semibold (shadcn has none);tracking-tighton all. Top margins: h2mt-10, h3mt-8, othersmt-6.mt-6apart; inside list items,mt-2(as items are).ml-6(a 6-unit marker column, 2-unit gap), itemsmt-2, markersmuted-foreground; nested bullets disc → circle → square, as browsers do.border-l-2 pl-6 italic,bordercolour,foregroundtext.bg-muted rounded-lg p-4, monospace at 0.875 em, no border.border. Unsupported box:border, 1 pt,rounded-lg,p-3, labelmuted-foreground.leading-7is not imposed).Follow-ups
Tests
{#id}; nested and ordered lists with tasks; quotes holding blocks; code info and text; images splitting paragraphs; rules; tables and HTML keeping their source; disabled extensions reading as text;headingsthrough quotes and lists. Each was seen failing first against atodo!().tests/it/markdown.rs(14), through the rig on the test page: every text block drawn; heading sizes and anchor keys; the outline; the h2 rule; markers one line tall on the first line with a painted disc; ordered numbering; the quote border; the code fill and monospace; the image at its texture size; an internal link scrolls its heading to the top and skipson_link; a relative link callson_linkand the page shows it; an external link opens and skipson_link; a registered directive mounts a live counter; the shadcn preset installs itsMarkdownStyle. Each was checked to fail with its piece removed (items_start, on_link pass-through, heading ids, directive lookup, heading rule).markdown_lightandmarkdown_dark(720×1540).cargo xtask ci: exit 0, run in the foreground on fresh main (5fbc2c2) plus #264.Needs a manual trial (UI):
cargo xtask example markdown, via the coordinator on 8851.Fixes #254
After the trial: a
#anchorlink naming a heading in the document now scrolls to it, as in a browser (Shell::scroll_into_view,Align::Min); it is no longer passed toon_link, while an anchor naming no heading still is. The test page's sentence links internal (#directives), relative (guide.md, shown in the status line) and external; the goldens change in that line only.Fixes #134
🤖 Generated with Claude Code
https://claude.ai/code/session_01PWiKKf74MNWrhkW1CvKVUP