Skip to content

feat(docs): standardize Markdown controls with Styling - #18

Merged
kaimacann merged 2 commits into
developmentfrom
codex/markdown-only-sections
Nov 10, 2026
Merged

kaimacann merged 2 commits into
developmentfrom
codex/markdown-only-sections

Conversation

@kaimacann

Copy link
Copy Markdown
Member

Summary

  • Render |||[...] tabs and ===[...] accordions through the shared @terra-symposium/styling/ui components in published pages and editor previews.
  • Remove Docs-specific tab/accordion wrappers and the parallel structured group editor path; preserve legacy structured content by serializing it to canonical Markdown.
  • Make TOC state updates equality-aware to stop repeated heading scans from rerendering and tripping the Docs workspace render guard.
  • Release as 0.4.11 with a Changesets changelog entry.

Verification

  • pnpm run check
  • pnpm run test:unit (69 passing)
  • pnpm exec astro build --config config/astro.config.mjs && pnpm run test:browser (33 browser tests and 33 load budgets passing)
  • pnpm run docs (15 pages built)
  • Inspected the rendered Docs page in the Codex in-app browser; shared Tabs and Accordion classes match Styling exports, and tab selection and accordion expansion work.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T12:44:18.886061Z 813b694 PR opened
🔒 Security Review ✅ Completed 2026-11-10T12:41:15.626318Z 813b694 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kaimacann
kaimacann merged commit 85dcb18 into development Nov 10, 2026
4 checks passed
@kaimacann
kaimacann deleted the codex/markdown-only-sections branch November 10, 2026 12:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 813b694fbe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +609 to +613
if (member._type === 'tabs' || member._type === 'accordion')
return {
_key: member._key,
_type: 'raw',
markdown: docsValueToMarkdown([member] as unknown as Parameters<

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Markdown groups independent of the raw-block opt-out

When a host sets blocks={{ raw: false }} but leaves tabs or accordion enabled, this conversion still changes every legacy group into a raw block. However, enabledDocsBlocks(blocks) omits raw from the editor schema and the renderer list is filtered by the same option, so the resulting initial value contains a block type the editor has no definition or renderer for. Existing tabs and accordions therefore cannot load normally under this valid per-block configuration; use an internal group source type that remains registered, or preserve the structured group when raw is disabled.

Useful? React with 👍 / 👎.

Comment on lines +134 to +140
raw: ({ attributes: attrs, children, node, readOnly, blocks }) => (
<div {...attrs} data-docs-editor-block="Raw Markdown">
<Raw block={node} />
{readOnly ? (
<MarkdownContent markdown={node.markdown ?? ''} options={blocks} />
) : (
<Raw block={node} />
)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Render only migrated group Markdown as live content

In read-only editors this now sends every existing raw block through the live Markdown parser, not just the newly migrated tab and accordion records. Raw blocks are also used to preserve literal imports, MDX examples, and unsupported source, so content such as import Nodes from '…' becomes a normal paragraph and group-like examples can become interactive controls instead of remaining source code as <Raw> previously rendered them. Use a distinct internal representation or marker for migrated groups and continue rendering ordinary raw blocks with <Raw>.

Useful? React with 👍 / 👎.

Comment thread src/lib/index.ts
Comment on lines 43 to 44
export { renderTable } from '../components/terra/editor/docs/_Table.js';
export { renderSections } from '../components/terra/editor/docs/_Tabs.js';
export { TsDocs } from '../components/terra/editor/docs/_TsDocs.js';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the published renderSections export in this patch release

This removes renderSections from the package root while publishing the change as version 0.4.11, even though it was a named public export and remains listed among the repository's framework entry exports. Existing JavaScript consumers importing it from @terra-symposium/docs will fail module instantiation with a missing-export error after a patch upgrade. Keep a compatibility export (it can be deprecated and unused internally), or defer the removal to a breaking release.

Useful? React with 👍 / 👎.

Comment thread src/components/blocks.tsx
Comment on lines +130 to +134
function groupItemMarkdown(item: Record<string, unknown>): string {
const content = Array.isArray(item.content) ? item.content : [];
return content.length
? docsValueToMarkdown(content as Parameters<typeof docsValueToMarkdown>[0])
: typeof item.markdown === 'string'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve legacy text shapes inside migrated groups

For legacy tab or accordion items whose body uses Terra's compact text form (_type: 'block' with c) or the supported paragraph/heading aliases, replacing stringifyDocBody with docsValueToMarkdown no longer produces their visible text. Those shapes fall back to typed directives; after reparsing, PortableTextBlockView only reads children, so compact blocks render empty while aliases surface as raw source. The previous serializer explicitly handled c, paragraph, and heading, so normalize these legacy shapes before the Markdown round trip or retain that serializer for group bodies.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant