docs(bigquery): fix table rendering in markdown docs - #18294
Conversation
There was a problem hiding this comment.
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.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Could you provide some details on how this test is covering the changes in conf.py ?
There was a problem hiding this comment.
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).
I add unit test for markdown translator monkeypatch.
tswast
left a comment
There was a problem hiding this comment.
The "after" screen/4GqUXF7gs4p6GZV is showing the view from Sphinx, but not the rendered view for the "Cloud RAD" docs. Please stage the documents there to evaluate this change properly.
go/cloud-rad/python?polyglot=split-repository#setup-for-staging-local-changes
Thanks, Tim. Here is the local stage: https://clouddocs.devsite.corp.google.com/python/docs/reference/bigquery/latest |
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.pythat 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)stage: https://clouddocs.devsite.corp.google.com/python/docs/reference/bigquery/latest
Fixes #<522853190> 🦕