Skip to content

[Feature Request]: Improved ES|QL examples output table formatting #718

Open

Description

@craigtaverner

Prerequisites

  • I have searched existing issues to ensure this feature hasn't already been requested
  • I have tested using the latest version of docs-builder

What problem are you trying to solve?

In the ES|QL docs, the examples have a query followed by the expected output. In the 8.x docs the output table is nicely formatted monospace, and clearly attached to the query, while in the new docs the table is not using a monospace font, and is visibly separated from the query. I read the docs on tables at https://elastic.github.io/docs-builder/syntax/tables/, and there does not appear to be any formatting option support like we used in asciidoc for this.

This is an example from 8.x:

Image

And this is an example from main (using docs-builder built locally on the 11th March):

Image

In 8.x we achieved this formatting in asciidoc with:

To count the number of rows, use `COUNT()` or `COUNT(*)`
[source.merge.styled,esql]
----
include::{esql-specs}/docs.csv-spec[tag=countAll]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/docs.csv-spec[tag=countAll-result]
|===

For main, we cannot use include like this, but we have written our own include feature as part of the docs generating process, so the markdown looks like:

To count the number of rows, use `COUNT()` or `COUNT(*)`

\```esql
FROM employees
| STATS count = COUNT(*) BY languages
| SORT languages DESC
\```

| count:long | languages:integer |
| --- | --- |
| 10 | null |
| 21 | 5 |
| 18 | 4 |
| 17 | 3 |
| 19 | 2 |
| 15 | 1 |

Proposed Solution

The missing piece is something similar to the line [%header.monospaced.styled,format=dsv,separator=|] from the asciidoc table. We don't need that exact set of arguments, but something that would allow us to achieve:

  • Monospaced font
  • Visible attachment of the table to the query:
    • remove separation
    • perhaps add a border so it is clear they are attached

Making it looks identical to the older docs is not required, but making it look like a results table, not a generic text table, is required.

Perhaps something like:

::::{table} font=monospaced padding=0 border=1
| count:long | languages:integer |
| --- | --- |
| 10 | null |
| 21 | 5 |
| 18 | 4 |
| 17 | 3 |
| 19 | 2 |
| 15 | 1 |
::::

Activity

  1. cotti commented on Jun 3, 2026

    @cotti
    Contributor

    AI triage

    Automated investigation against the current codebase. A human still needs to confirm before any code change.

    Original concern

    ES|QL examples render their result tables as plain, sans-serif Markdown tables that float free of the preceding query, instead of the monospaced, visually-attached "result" tables AsciiDoc produced via [%header.monospaced.styled,...]; the request is a way to mark a table as an ES|QL result table.

    Findings

    • src/Elastic.Markdown/Myst/CodeBlocks/SupportedLanguages.cs:L50 and src/Elastic.Documentation.Site/Assets/hljs.ts:L2,L54 — esql exists only as a syntax-highlighting language for the query code block. There is no notion of an attached "result" payload, so the output table is just an ordinary pipe table sitting after the code fence.
    • src/Elastic.Documentation.Site/Assets/markdown/table.css:L17-L39 — every Markdown/{csv-include} table is styled the same: bordered, sans-serif header (font-sans, L27), no monospace path anywhere. The only font-mono rules in the asset tree are for callout badges, inline code, kbd, and footnotes — none reach data tables.
    • src/Elastic.Documentation.Site/Assets/markdown/table.css:L2-L3 — the table wrapper carries its own my-4 vertical margin, which (stacked on the code block's own margin) produces exactly the "visibly separated from the query" gap the issue describes.
    • src/Elastic.Markdown/Myst/Directives/Table/TableDirectiveBlock.cs:L16-L50 — a {table} directive now exists, but it reads only Prop("widths") (a 12-unit column-width grid). It has no font / border / padding / class / "result" option — i.e. it does not implement the styling axes this issue asks for. Added in PR #2852 (commit 05f168a5, 2026-03-13), after this issue was filed.
    • src/Elastic.Markdown/Myst/Directives/CsvInclude/CsvIncludeBlock.cs + docs/syntax/csv-include.md:L3 — {csv-include} also renders through the same table.css, so it is not a monospace/result-table escape hatch either.

    Verdict

    Needs stakeholder input

    The requested capability does not exist: there is no monospaced, query-attached "result table" style, and the {table} directive only controls column widths. Closing the gap is not a mechanical fix — it changes reader-visible rendering (monospace font, removed separation, attaching border) and introduces new author-facing markup (the issue itself proposes ::::{table} font=monospaced padding=0 border=1). Both the visual treatment and the authoring surface are design decisions, so this needs UX + writer sign-off before implementation.

    Proposal

    Open questions to resolve before coding:

    • UX — What should an ES|QL result table look like? Monospace cell font, removal of the my-4 top margin so it abuts the query, and a connecting border/background? Should it visually read as one unit with the code block above it (shared corner radius / no gap), and does it need a dark-mode variant?
    • Writer — How do authors opt in? Options to weigh: (a) extend the existing {table} directive with a style/variant option (e.g. :class: esql-result or :style: result) rather than the issue's key=value syntax, which {table} does not use; (b) a dedicated {esql-result} (or {result-table}) directive; or (c) auto-detect a table immediately following an esql block. Each has a different migration cost for the generated ES|QL docs.
    • Eng (minor) — If the answer is a style variant, it's a small change (new Prop + a CSS class in table.css); if it's auto-attachment to the preceding code block, it needs parser-level coordination between the code block and the following table.

    Related issues

    Part of a broader tables cluster, all open unless noted: #112 ([Discuss] Tables), #508 (list support in table cells), #3449 (footnotes/callouts in tables), and #534 (column-padding bug, closed). #718 is distinct (a result-table style variant, not a duplicate), but a maintainer may want to plan a coherent table-styling roadmap across these. #816 (closed) covered ES|QL query highlighting, not the output table, so it's adjacent rather than overlapping.

    Notes

  2. added
    ai-triaged
    ai:ux-question
    ai:writer-question
    on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-triagedai:ux-questionai:writer-questionenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions