← Back to Pull requests

ui: draw markdown tables with row rules instead of a grid #33195

Closed
unknown closed this pull request without merging on Nov 27, 2026 16:20 UTC
View on GitHub
unknown unknown commented on Nov 27, 2026 14:21 UTC
Author

Overview

A markdown table in a chat message sits on a hairline under each row now. It drew a rule around every cell, a band behind the header and a frame around its scroll wrapper, which read heavier than the prose around them.

Demo

<!-- demo:start -->
| Rows carry the table | And on a phone |
|---|---|
| ![Rows carry the table](https://huggingface.co/buckets/allozaur/llama-ui-demos/resolve/videos/pr/33195/ee0e03967d-1.mp4?v=b2067c0dfb) | ![And on a phone](https://huggingface.co/buckets/allozaur/llama-ui-demos/resolve/videos/pr/33195/ee0e03967d-2.mp4?v=55f2d92863) |

Recorded at ee0e03967d; click a preview for its full video.
<!-- demo:end -->

Additional information

<details>
<summary>What changed</summary>

  • A table draws one hairline under each row. The vertical rules, the zebra striping, the header band and the frame around .table-wrapper are gone, and the header is set heavier instead of filled. The line colour is one custom property, so the tinted user bubble retints it once rather than overriding four selectors. (The old band and zebra never painted: hsl(var(--surface-muted) / 0.3) is not valid CSS, --surface-muted is a colour already.)

  • Cells are 0.875rem with tabular-nums, so a column of figures lines up on its digits, and the gutters are wider (1.25rem) with the outer columns flush, so a table's edges line up with the text above and below it.

  • Column alignment works. GFM writes align="right", and an authored text-align beats a presentational attribute, so the th { text-align: left } that was there quietly dropped the right and centre columns of | :--- | ---: | :---: |. All three values are restated.

  • A cell keeps what is in it: inline code stays one token, a <ul> or <br> that rehypeRestoreTableHtml puts in a cell no longer inherits the prose list margins, and a user message overrides the bubble's overflow-wrap: anywhere, which pulled every column down to a few letters.

  • A table of six or more columns keeps a width a word sits on (min-width: 7rem) and scrolls in its wrapper, instead of crumbling every cell to three lines.

  • transition: all on table and the shadow on its hover are gone. The row highlight stays, as one tint on the row under the pointer.
  • </details>

    <details>
    <summary>Testing</summary>

    In ui/apps/chat, npm run check, npm run lint, npm run test:unit (940 tests) and npm run test:client (409 tests) pass. Not run: npm run build and npm run test:e2e.

    A Tables story covers it (tests/stories/content/MarkdownContent.stories.svelte, fixture markdown-tables.ts): column alignment, code and links in cells, a list and a line break in a cell, an escaped pipe, an empty cell, and a table wider than the message. Its play checks that the wrapper draws no frame, the header carries no fill, the rows carry the hairline, the cells carry no vertical rule, and a right-aligned column computes to text-align: end:

    npm run test:ui -- tests/stories/content/MarkdownContent.stories.svelte
    

    The assertions are load-bearing: against the previous CSS they fail on the wrapper's frame (expected '1px' to be '0px').

    </details>

    <details>
    <summary>Demo script</summary>

    ``ts demo
    // one reply, three tables: right-aligned numbers, code in cells, and one wider than the message
    const REPLY = [
    'Here is what I would run:',
    '',
    '## Quantization',
    '',
    '| Type | Bits per weight | Size (7B) | Notes |',
    '| :--- | ---: | ---: | :--- |',
    '|
    Q4_K_M | 4.85 | 4.07 GB | A good default for most models |',
    '|
    Q5_K_M | 5.69 | 4.78 GB | A little more quality for a little more memory |',
    '|
    Q8_0 | 8.50 | 7.16 GB | Close to the original weights |',
    '',
    '## Flags worth setting',
    '',
    '| Flag | Default | Description |',
    '| :--- | :---: | :--- |',
    '|
    --ctx-size | 4096 | Context size in tokens |',
    '|
    --parallel | 1 | Slots that serve requests at once |',
    '|
    --jinja | on | Use the model\'s own chat template |',
    '',
    'The run I measured, which is wider than the message:',
    '',
    '| Model | Family | Parameters | Context | Quantization | Prompt t/s | Generation t/s | Memory | Backend |',
    '| :--- | :--- | ---: | ---: | :--- | ---: | ---: | ---: | :--- |',
    '| gpt-oss-20b | GPT-OSS | 20.9B | 131072 | MXFP4 | 1890.4 | 74.2 | 12.1 GB | Metal |',
    '| Qwen3-8B | Qwen3 | 8.2B | 40960 | Q4_K_M | 1312.7 | 58.9 | 5.0 GB | Metal |'
    ].join('\n');

    test.use({ mockServer: { models: ['ggml-org/gemma-3-4b-it-GGUF:Q4_K_M'], reply: REPLY } });

    async function askForTables(demo, page) {
    const input = page.getByRole('textbox').first();

    await demo.type(input, 'Compare the quantizations and the flags I need, in tables', 900);
    await demo.click(page.getByRole('button', { exact: true, name: 'Send' }));
    await page.locator('.markdown-content table').last().waitFor();
    }

    /* Scrolls the wrapper of the last table sideways, the way a wide table is read. /
    async function scrollWideTable(page, left) {
    const wrapper = page.locator('.table-wrapper').last();

    await wrapper.scrollIntoViewIfNeeded();
    await wrapper.evaluate((el, x) => el.scrollBy({ behavior: 'smooth', left: x }), left);
    }

    test('Rows carry the table', async ({ demo, page }) => {
    const tables = page.locator('.markdown-content table');

    await askForTables(demo, page);

    await demo.caption('One hairline under each row: no grid, no header band, no frame');
    await demo.pause(1200);
    await tables.first().scrollIntoViewIfNeeded();
    await demo.zoom(tables.first(), 1.8, 1600);
    await demo.caption('A right-aligned column keeps its figures under the header');

    await demo.caption('A table wider than the message scrolls inside it');
    await scrollWideTable(page, 320);
    await demo.pause(1200);
    });

    test.describe('phone', () => {
    test.use({ hasTouch: true, isMobile: true, viewport: { height: 844, width: 390 } });

    test('And on a phone', async ({ demo, page }) => {
    await askForTables(demo, page);

    await demo.caption('The same rows in a phone-width message');
    await demo.pause(800);
    await scrollWideTable(page, 240);
    await demo.pause(1000);
    });
    });
    `

    </details>

    Requirements

    <!-- IMPORTANT: Please do NOT delete this section, otherwise your PR may be rejected -->

  • I have read and agree with the contributing guidelines

  • AI usage disclosure: YES, Llama Chat (unsloth/Qwen3.8-Flash-Next:IQ4_XS`)[^1]
  • [^1]: https://huggingface.co/datasets/allozaur/llama-chat-traces/blob/main/2026-11-27_14-53-06_conv_dfa161d3_i_want_to_have_bette.jsonl

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: Sumdiboii Review duration: 119m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #33195"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%