Skip to content

fix(theme): add remark plugin to tag wide table columns#238

Open
jp-ayyappan wants to merge 7 commits intomainfrom
fix/table-display
Open

fix(theme): add remark plugin to tag wide table columns#238
jp-ayyappan wants to merge 7 commits intomainfrom
fix/table-display

Conversation

@jp-ayyappan
Copy link
Copy Markdown
Contributor

@jp-ayyappan jp-ayyappan commented Mar 12, 2026

Summary

  • Add a remark plugin (remark-table-wide-cells) that detects markdown table columns where any cell exceeds 100 characters and tags all cells in those columns with a wide-cell CSS class
  • Tagged columns get white-space: normal; word-break: break-word so long text wraps, while short columns stay compact with nowrap
  • Base table styling uses overflow-x: auto so genuinely wide tables still scroll horizontally
  • OpenAPI-generated tables are unaffected (rendered at the theme layer, not by remark)

Test plan

  • Run npm start and confirm the build succeeds
  • Navigate to markdown pages with tables — short columns should stay compact, long columns should wrap
  • Confirm a horizontal scrollbar appears if a table is still wider than the viewport
  • Verify OpenAPI spec pages are unaffected
  • Test in both light and dark themes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Tables now auto-detect very wide content and enable targeted wrapping for affected columns, while preserving horizontal scrolling to avoid layout overflow.
  • Style

    • Enhanced table styling: wide-column cells allow wrapping and improved word-breaking with a minimum column width for better readability and stable document layout.

Add a remark plugin that detects columns with long text content and
applies a `wide-cell` CSS class for targeted word-wrapping, keeping
short columns compact while preventing wide columns from overflowing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jp-ayyappan jp-ayyappan requested review from a team as code owners March 12, 2026 04:08
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the display of markdown tables within Docusaurus documentation by intelligently handling long cell content. It introduces a mechanism to identify and style wide table columns, ensuring text wraps appropriately without affecting the compactness of other columns, while maintaining overall table responsiveness through horizontal scrolling. This improves readability and user experience for tables containing extensive data.

Highlights

  • New Remark Plugin: A new remark-table-wide-cells plugin has been added to automatically detect markdown table columns where any cell's content exceeds 100 characters and apply a wide-cell CSS class to all cells in those columns.
  • Targeted Word Wrapping: CSS rules have been introduced to apply white-space: normal; word-break: break-word specifically to cells tagged with wide-cell, allowing long text to wrap while keeping shorter columns compact with nowrap.
  • Table Responsiveness: Base table styling now includes overflow-x: auto to ensure that genuinely wide tables remain horizontally scrollable, preventing layout issues.
  • Configuration Update: The Docusaurus configuration has been updated to integrate the new remark-table-wide-cells plugin into the docs plugin's remark processing pipeline.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • docusaurus.config.ts
    • Configured the Docusaurus docs plugin to use the new remark-table-wide-cells plugin with a default threshold of 100 characters.
  • plugins/remark-table-wide-cells.js
    • Created a new Remark plugin that identifies table columns where any cell's text content exceeds a specified character threshold (defaulting to 100).
    • Implemented logic to apply the wide-cell CSS class to all cells within identified wide columns.
    • Included a helper function extractText to recursively get plain text from MDAST nodes.
  • src/css/custom.css
    • Added new CSS rules for .markdown table to ensure horizontal scrolling (overflow-x: auto) and prevent default wrapping (white-space: nowrap).
    • Defined styles for .markdown table td.wide-cell and .markdown table th.wide-cell to enable word-wrapping (white-space: normal; word-break: break-word) and set a min-width for tagged wide cells.
Activity
  • No human activity has occurred on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Remark plugin, remark-table-wide-cells, to improve the readability of markdown tables with long content. The plugin identifies columns containing cells that exceed a character threshold and applies a wide-cell CSS class to them. Accompanying CSS changes then enable word wrapping for these specific columns, while keeping other columns compact. The implementation is solid. I've added a couple of suggestions to the plugin to improve performance and robustness.

Comment thread plugins/remark-table-wide-cells.js
Comment thread plugins/remark-table-wide-cells.js Outdated
jp-ayyappan and others added 3 commits March 12, 2026 00:10
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
copilot suggestion

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

📄 Preview deployed to https://opentdf-docs-pr-238.surge.sh

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

📝 Walkthrough

Walkthrough

Adds a Remark plugin and CSS to mark table columns whose cell text exceeds a configured threshold as wide-cell, and to make tables horizontally scrollable while allowing targeted wrapping for those wide cells.

Changes

Cohort / File(s) Summary
Configuration
docusaurus.config.ts
Registers ./plugins/remark-table-wide-cells in the docs preset remarkPlugins with option { threshold: 40 }. No other config changes.
Plugin Implementation
plugins/remark-table-wide-cells.js
New CommonJS Remark plugin remarkTableWideCells({ threshold = 100 } = {}) that visits table nodes, derives column count from the first row, extracts text (handles text, inlineCode, and descendant children), identifies columns exceeding the threshold, and adds wide-cell to each affected cell's cell.data.hProperties.className, preserving and deduplicating existing classes (uses Set). Includes early exits for missing children, zero columns, or no wide columns.
Styling
src/css/custom.css
Adds rules under “TABLES — responsive with targeted wrapping”: makes .markdown table display as block, max-width: 100%, overflow-x: auto, white-space: nowrap; sets .wide-cell to allow wrapping (white-space: normal), overflow-wrap: anywhere, word-break: normal, and min-width: 200px.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through rows and cells so wide,

I tagged the ones that could not hide.
Scrolls appear where space runs thin,
Wide cells wrap and tuck right in.
A hop, a nudge — tables beam with pride.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(theme): add remark plugin to tag wide table columns' directly and clearly describes the main change: adding a remark plugin to identify and tag wide table columns. It is concise, specific, and matches the core objective of the pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/table-display

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
plugins/remark-table-wide-cells.js (1)

56-57: Normalize className before spreading to avoid character-splitting if upstream provides a string.

The hast specification allows className to be either an array or string. If cell.data.hProperties.className receives a string from upstream (possible via other remark plugins), spreading it with [...existing, 'wide-cell'] will split it into individual characters rather than combining class names.

Suggested fix
-          const existing = cell.data.hProperties.className || [];
-          cell.data.hProperties.className = Array.from(new Set([...existing, 'wide-cell']));
+          const rawClassName = cell.data.hProperties.className;
+          const existing = Array.isArray(rawClassName)
+            ? rawClassName
+            : rawClassName
+              ? [rawClassName]
+              : [];
+          cell.data.hProperties.className = Array.from(new Set([...existing, 'wide-cell']));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/remark-table-wide-cells.js` around lines 56 - 57, Normalize and
dedupe the className before spreading: ensure cell.data and
cell.data.hProperties exist, coerce cell.data.hProperties.className to an array
(if it's a string, split on whitespace and filter empty entries; if it's already
an array use it; otherwise use []), then set cell.data.hProperties.className =
Array.from(new Set([...existingArray, 'wide-cell'])). Refer to
cell.data.hProperties.className and the local variable existing (or replace it)
when making this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/css/custom.css`:
- Around line 615-619: The CSS rule for the selectors .markdown table
td.wide-cell and .markdown table th.wide-cell uses the deprecated word-break:
break-word; update this rule to set word-break: normal; and add overflow-wrap:
anywhere; (or overflow-wrap: anywhere; word-break: normal;) to preserve the
intended wrapping behavior across browsers while removing the deprecated value.

---

Nitpick comments:
In `@plugins/remark-table-wide-cells.js`:
- Around line 56-57: Normalize and dedupe the className before spreading: ensure
cell.data and cell.data.hProperties exist, coerce
cell.data.hProperties.className to an array (if it's a string, split on
whitespace and filter empty entries; if it's already an array use it; otherwise
use []), then set cell.data.hProperties.className = Array.from(new
Set([...existingArray, 'wide-cell'])). Refer to cell.data.hProperties.className
and the local variable existing (or replace it) when making this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c0917075-6be1-441e-aaf9-33f4cea2c0fc

📥 Commits

Reviewing files that changed from the base of the PR and between 6a708b1 and f3b0c33.

📒 Files selected for processing (3)
  • docusaurus.config.ts
  • plugins/remark-table-wide-cells.js
  • src/css/custom.css

Comment thread src/css/custom.css
@jp-ayyappan jp-ayyappan changed the title feat(tables): add remark plugin to tag wide table columns fix(ci): add remark plugin to tag wide table columns Apr 7, 2026
jp-ayyappan and others added 2 commits April 7, 2026 10:31
- Lower threshold from 100 → 40 to match DSP (more aggressively catches wide columns)
- Add string guard for className to match DSP's defensive handling
- Replace deprecated word-break: break-word with overflow-wrap: anywhere per CSS Text Level 4 spec (CodeRabbit DSPX-2800)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@jp-ayyappan jp-ayyappan changed the title fix(ci): add remark plugin to tag wide table columns fix(theme): add remark plugin to tag wide table columns Apr 7, 2026
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