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).
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.
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)Fixes #<522853190> 🦕