Repository navigation
fix: keep field tables in llms-txt output and type composed schemas - #38
Merged
Merged
Conversation
Quarto builds `.llms.md` with Pandoc's GFM writer, which writes `[TABLE]` for any table with block content in a cell. Description cells are now one paragraph: paragraphs and attributes are spans the stylesheet lays out as lines, and lists or code blocks move to a note under the table. `anyOf`/`oneOf` properties are typed by their alternatives (`Owner|null`) instead of `unknown`, and a nullable reference to an object lists the object's properties, with a guard against recursive schemas. Closes #24 Closes #37 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e rendering Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ne path Field tables now come in two forms. The list table is wrapped in `content-hidden when-format="llms-txt"` and is unchanged in the HTML page, lists and code blocks included. A bullet list with one item per field is wrapped in `content-visible when-format="llms-txt"`, so `.llms.md` gets every description block without Pandoc's GFM writer turning the table into `[TABLE]`. This replaces the span rewrite of description cells, which needed the extension's stylesheet (loaded only with the extension's format) and still produced `[TABLE]` for a description with an inline `<br>`. Schema typing goes through one normalize step (resolve `$ref`, merge `allOf` including non-object members) and one type label function, so: - `allOf` around a primitive keeps its type and enum - nested object rows show their attributes and `|null` - arrays, maps and alternative members label consistently (`[string]|null`, `map[string, string|integer]`, a member's own `nullable`) - a circular reference is labelled by the schema it repeats - parameters use the same labels and attributes as properties - a request or response body that is `anyOf`/`oneOf` renders each alternative Co-Authored-By: Claude Opus 5.5 <[email protected]>
dotNomad
marked this pull request as ready for review
November 12, 2026 19:32
Pandoc 3.8 (Quarto 1.9) writes a hard line break as two trailing spaces, and Pandoc 3.10 (Quarto 1.11) writes it as a trailing backslash. Both are GFM hard breaks, so the test accepts either. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
cc: @sarahsdao for visibility in case that has come up for other repos's docs as well |
mconflitti-pbc
approved these changes
Nov 12, 2026
mconflitti-pbc
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
Out of curiosity, why separate lines for the table's cells rather than building a markdown table? your approach is probably more token efficient though
Contributor
Author
GitHub Flavored Markdown table cells only support inline content: no paragraph breaks, lists, or code blocks. Our API descriptions use those, so I wrote each field as a list item instead of a table row. |
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.
Closes #24
Closes #37
Two fixes to the generated field tables:
.llms.md, field tables come through as a list of fields instead of[TABLE].allOf,anyOforoneOfget a real type instead ofunknown. Their enums, defaults and nested fields are kept.The HTML page keeps the same table design. The table contents change: type labels, attributes and nested rows.
Field tables in
.llms.md(#24)Quarto builds each
.llms.mdfrom the rendered HTML withpandoc -t gfm-raw_html. A GFM table cell can only hold inline content, so Pandoc writes[TABLE]for any table with a paragraph break, a list or a<br>in a cell. Almost every field table has one, because the "Required. Example: …" line is its own paragraph.fieldTable()in the newlib/fields.tsnow writes each field table twice, using Quarto's conditional content:::: {.content-hidden when-format="llms-txt"}holds the list table, unchanged.::: {.content-visible when-format="llms-txt"}holds one bullet per field,- `name` (`type`), with the description and attributes as the item's paragraphs. A list item can hold any Markdown, so nothing is flattened.Quarto keeps the
llms-txtform out of the HTML page andsearch.json. Both forms are built from the sameFieldRows.Before:
After:
Types for composed schemas (#37)
formatTypeStringfell back tounknownfor any schema withouttype. Property rows, parameters and bodies now all go through onenormalizestep and onetypeLabelfunction.normalizeresolves$refand mergesallOfmembers, including non-object ones.anyOf: [{$ref: Owner}, {nullable: true}]unknownobject|null, plusowner.id,owner.name, … rowsanyOf: [{type: string}, {type: integer}]unknownstring|integeranyOf: [{type: string, nullable: true}, {type: integer}]unknownstring|null|integeranyOf: [{type: array, items: …}, {nullable: true}]unknown[string]|nullallOf: [{$ref: StatusEnum}]object, enum droppedstring,Enum: …allOf: [{$ref: Owner}], nullable: trueobjectobject|nullanyOfvaluesmap[string, object]map[string, string|integer]{}unknownany[unknown][Expr]oneOf: [Cat, Dog]Parameters now show the same types and attributes as properties, so
enum,defaultand|nullappear. Nested object rows now show their attributes ("Required.", "Read-only."), which were dropped before.Labels describe the structure instead of naming the
$refas #37 suggests.resolve()expands nested$refs before a table is built, so the name is gone by then, and the listed fields say more than the name would. The exception is a circular reference, where expansion stops:expandRefsmarks the stub withx-circular-ref, and the label names the schema it would repeat.Not covered yet: a property with more than one object alternative (
oneOf: [Cat, Dog]inside an object) is labelledobject, and its alternatives' fields aren't listed. That needs its own row design.Changes to the HTML page
owner.guidappear.Results on a large API reference
Rendering an API reference of about 100 paths and 200 schemas, changing only this extension:
[TABLE]in.llms.mdunknowntypesmainThese counts were measured on an earlier commit of this branch and haven't been re-run. The
[TABLE]count of 0 follows from the design, because no field table reaches.llms.mdas a table.Tests
tests/fields_test.ts: both forms and their wrappers.tests/quarto_render_test.ts: renders a field table withllms-txt: trueand checks that.llms.mdhas no[TABLE]and keeps paragraphs, lists and line breaks, and that the HTML has none of the list form. It fails without the conditional wrappers.tests/schema_test.ts: each row of the type table above.tests/render_test.ts: parameter types and attributes from composed schemas.tests/markdown_test.ts: an empty cell keeps a list-table row tight.npm run checkpasses (161 tests) with Quarto 1.9.36 and 1.11.7, andnpm run sync-example -- --checkis clean. Quarto handleswhen-format="llms-txt"this way from 1.9.23, which covers every stable 1.9 release. Not yet checked with Quarto 2.🤖 Generated with Claude Code