feat(page): ship DocsUI::Table + DocsUI::PropTable — stop hand-rolling tables - #28
Merged
Conversation
…ocal one
## Summary
Upstreams the dogfooded reference-table design into the kit so every docs site
stops hand-rolling `table`/`tr`/`td` markup:
- `DocsUI::Table.new(headers, rows)` — generic headers + rows in the kit's
daisyUI look (`table table-sm table-zebra` in a `rounded-box` border,
`not-prose`). Cell values: `String` (plain, escaped), `[:code, "x"]` (inline
code), `[:md, "…"]` (inline GFM through `DocsUI::Markdown`).
- `DocsUI::PropTable.new(rows, headers:)` — a thin preset built ON `Table`
(composition, no markup duplication): name/type/default/description, first
column auto code-styled, `Option/Type/Default/Description` headers by default,
overridable via `headers:`.
- `DocsUI::Markdown.inline` — a no-wrapper, no-`<p>` render for `[:md, …]` cells;
adjacent top-level paragraphs are space-joined so unwrapping never fuses text.
Deletes the page-local `Views::Docs::Pages::PropTable` ("Not part of the DocsUI
kit") and swaps all 18 call sites across 7 docs pages to `DocsUI::PropTable`.
Documents both components on the components reference page (with a live demo of
all three cell types) and the README component table.
## Test Coverage
- spec/docs_ui/table_spec.rb — headers→th, rows→td, [:code]→<code>, [:md]→inline
markdown, empty rows → headers only, HTML in a string cell / header escaped.
- spec/docs_ui/prop_table_spec.rb — first column code-styled, default + custom
headers, [:code]/[:md] honored in other columns, reuses Table's wrapper.
- spec/docs_ui/markdown_spec.rb — .inline: no <p>/Prose wrapper, soft break → one
space, multiple paragraphs separated (regression: no "onepara" fusion).
## Verification
- [x] bundle exec rspec — 121 examples, 0 failures
- [x] bundle exec rubocop — 48 files, no offenses
- [x] cd docs && bun run build:css — clean; table-zebra/rounded-box/not-prose present
- [x] Rendered /docs/configuration + all 7 swapped pages — HTTP 200, tables intact
- [x] No page-local PropTable references remain
Closes #11
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 #11 (Part of #8, Phase 1).
Problem
Reference tables were the most duplicated markup in the ecosystem: the gem's own docs carried a page-local
PropTableexplicitly marked "Not part of the DocsUI kit", and every consuming site hand-rolled its owntable/tr/tdblocks. None could get an options/params/errors table from the gem.What changed
Upstreams the dogfooded design into the kit, generalized:
DocsUI::Table.new(headers, rows)— generic headers + rows in the kit's daisyUI look (table table-sm table-zebrainside arounded-boxborder,not-prose). Cell values follow the proven convention:String→ plain, Phlex-escaped text[:code, "x"]→ inline<code>[:md, "…"]→ inline GFM throughDocsUI::Markdown(opt-in, so a plain string that merely looks like markdown is never surprise-parsed)DocsUI::PropTable.new(rows, headers:)— a thin preset built ONTable(composition, no markup duplication): first column auto code-styled,Option/Type/Default/Descriptionheaders by default, overridable viaheaders:.DocsUI::Markdown.inline— a no-wrapper, no-<p>render used by[:md, …]cells. Adjacent top-level paragraphs are space-joined so unwrapping never fuses text.Both are kit-form-callable (
DocsUI::Table(...)/DocsUI::PropTable(...)) automatically viainclude DocsUI.Delta for a consuming site
New components, fully backwards compatible — nothing existing changes. A site can now render an args/options table from the gem instead of hand-writing daisyUI table markup.
Cleanup in this repo
Views::Docs::Pages::PropTable.PropTable.newcall sites across 7 docs pages toDocsUI::PropTable(the constructor flips from(headers, rows)to(rows, headers:); the default headers are dropped where they were the default).Table+PropTableon the components reference page (with a live demo of all three cell types) and in the README component table.Test plan
spec/docs_ui/table_spec.rbth, rows→td,[:code]→<code>,[:md]→inline markdown, empty rows → headers only, HTML in a string cell / header escapedspec/docs_ui/prop_table_spec.rb[:code]/[:md]honored in other columns, reusesTable's wrapperspec/docs_ui/markdown_spec.rb.inline: no<p>/Prose wrapper, soft break → one space, multiple paragraphs separated (regression against a "onepara" fusion bug caught in adversarial review)Verification
bundle exec rspec— 121 examples, 0 failuresbundle exec rubocop— 48 files, no offensescd docs && bun run build:css— clean;table-zebra/rounded-box/not-prosepresent in the built CSS/docs/configuration+ all 7 swapped pages via a real HTTP request — HTTP 200, tables identical to before the swapPropTablereferences remainOut of scope (per the issue)
FieldTable/ErrorTableAPI presets (Phase 2 — they build on this).