Skip to content

docs(bigquery): fix table rendering in markdown docs - #18294

Open
shuoweil wants to merge 3 commits into
mainfrom
shuowei-fix-bigquery-docs-table-format
Open

docs(bigquery): fix table rendering in markdown docs#18294
shuoweil wants to merge 3 commits into
mainfrom
shuowei-fix-bigquery-docs-table-format

Conversation

@shuoweil

@shuoweil shuoweil commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

This monkeypatch is an isolated workaround in docs/conf.py while a permanent upstream fix is not scheduled in gcp-sphinx-docfx-yaml.

Fixes table formatting in the generated Markdown reference documentation for google-cloud-bigquery.
When building Markdown documentation via sphinx-markdown-builder, table cell paragraphs unconditionally emit trailing newlines. This breaks single-line GitHub Flavored Markdown (GFM) table rows, causing cell padding to be interpreted as 4-space indented code blocks on reference doc pages.

This change adds a targeted patch in docs/conf.py that suppresses newlines when exiting paragraphs inside table cells, restoring valid GFM table syntax.

before: screen/3oup25c57irb8
after: screen/4GqUXF7gs4p6GZV (render locally with nox -s doxfx)

Fixes #<522853190> 🦕

@shuoweil
shuoweil requested review from a team as code owners September 4, 2026 19:26
@shuoweil
shuoweil requested review from Edvc97, sycai and tswast and removed request for a team September 4, 2026 19:26
@shuoweil shuoweil self-assigned this Sep 4, 2026

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

Copy link
Copy Markdown
Contributor

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 workaround in docs/conf.py to suppress trailing newlines in table cells generated by sphinx-markdown-builder, preserving valid GFM tables. It also adds a unit test to verify that docs/conf.py executes successfully. The reviewer recommended gracefully skipping this new unit test if docs/conf.py is not found, which can happen when tests are run against an installed package where the docs/ directory is absent.

Comment thread packages/google-cloud-bigquery/tests/unit/test_docs.py
shuoweil and others added 2 commits September 4, 2026 12:39
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you provide some details on how this test is covering the changes in conf.py ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

test_docs.py is currently a smoke test to verify docs/conf.py executes without runtime errors and preserves basic configuration.

Because documentation dependencies (sphinx-markdown-builder) are not installed in the unit test environment, the monkeypatch logic is bypassed during unit tests via except ImportError. The formatting fix itself was verified end-to-end using nox -s docfx by inspecting the generated Markdown (docs/_build/html/docfx_yaml/index.md).

If unit-level coverage for the monkeypatch is preferred, I can add a test with mocks to verify that MarkdownTranslator.depart_paragraph suppresses newlines inside table cells, or remove test_docs.py if the smoke test is not needed.

@shuoweil
shuoweil requested a review from sycai September 9, 2026 22:50
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.

2 participants