posit-dev / posit-dev/quarto-openapi

Grid tables are dropped from llms-txt output

Open
#24 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3
Forks
1
Avg merge
11d 5h
Merged PRs (30d)
3

Description

What happens

When a project sets llms-txt: true, every table this extension generates disappears from the .llms.md output. In place of each table, the output holds the literal string [TABLE].

Why

Quarto builds each .llms.md file from the rendered HTML, not from the source markdown. The conversion runs pandoc -f html -t gfm-raw_html.

gridTable (_extensions/quarto-openapi/lib/markdown.ts:16) emits a Pandoc grid table. The doc comment states the intent:

Grid tables support multi-line cells and are the most flexible table format in Pandoc/Quarto.

Multi-line cells are the problem. A grid table cell that holds block content becomes a <p> or a <ul> in the HTML. A GFM pipe table cannot hold block content in a cell, so pandoc falls back to raw HTML. The -raw_html extension then strips that HTML, and the placeholder is all that remains.

Tables whose cells hold only inline content convert without a problem.

Scale

The Posit Connect API reference uses this extension. Numbers from a full render:

  • _site/api/index.html holds 1013 generated tables.
  • 879 of those tables have a <p> element inside a cell.
  • _site/api/index.llms.md holds 879 [TABLE] placeholders.

The match is exact. Every table with block content in a cell is lost, and the 134 inline-only tables survive. The parameter and schema reference is therefore absent from the llms output.

To reproduce

  1. Add llms-txt: true to _quarto.yml.
  2. Render a spec that has a parameter whose description holds a paragraph and a bulleted list.
  3. Open the generated .llms.md file. The table is now [TABLE].

A typical trigger is a query parameter that documents its accepted values as a list under an introductory paragraph.

Callers

  • _extensions/quarto-openapi/lib/schema.ts:175
  • _extensions/quarto-openapi/lib/sections.ts:405

Possible directions

The trade-off here is yours to make. Three options:

  1. Emit a pipe table when every cell holds inline content, and keep the grid table only when a cell needs blocks. This shrinks the loss but does not remove it.
  2. Move list-valued descriptions out of the cell. Render them as a nested or definition list below the table. The HTML then converts cleanly.
  3. Keep the HTML table and ask Quarto to retain raw_html for llms output. This needs a change in Quarto, not here.

Option 2 preserves the most information in both outputs, but it changes the rendered HTML layout.

I am glad to test a fix against the Connect reference, which is a large real-world spec.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with _extensions/quarto-openapi/lib/markdown.ts:16, then inspect the callers in _extensions/quarto-openapi/lib/schema.ts:175 and _extensions/quarto-openapi/lib/sections.ts:405. Reproduce the issue with llms-txt enabled and a block-content table cell, then verify that the chosen approach preserves the table information in the generated .llms.md output.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.