rctruta opened a new pull request, #28008: URL: https://github.com/apache/datafusion/pull/28008
## Which issue does this PR close? - Closes #28007. ## Rationale for this change `docs/rustdoc_trim.py` previously matched Rust code blocks with `re.compile(r"```rust(?:,ignore)?\s*(.*?)```", re.DOTALL)`, which: 1. Mangled the 4-backtick ```` ````rust ```` example in `docs/source/contributor-guide/testing_infrastructure.md` by matching its last 3 backticks and closing early on inner `/// ``` `. 2. Sliced info strings like ```` ```rust,no_run ```` / ```` ```rustfmt ```` and closed early on ```` "```" ```` inside Rust string literals. 3. Left orphan blank lines at the top of rendered code blocks after `# ` setup imports were removed. 4. Triggered $O(N^2)$ backtracking on unclosed ```` ```rust ```` fences. ## What changes are included in this PR? - Replace the regex in `docs/rustdoc_trim.py` with a single-pass CommonMark fence scanner that tracks opening fence character and length, normalizes `rust` / `rust,<attr>` headers while preserving fence width, ignores nested blocks inside outer non-Rust fences (e.g. ```` ````markdown ````), and strips blank lines left behind by removed `# ` lines. - Add `docs/test_rustdoc_trim.py` and run it in `docs/build.sh`. ## What is the testing strategy for this PR? - Unit tests in `docs/test_rustdoc_trim.py` (run automatically in `docs/build.sh` during the `Docs` CI job). - Verified output across all 76 Sphinx source files (`70` `.md` and `6` `.rst`) in `docs/source/`. ## Are there any user-facing changes? Fixes broken code-block rendering in `contributor-guide/testing_infrastructure.md` and removes leading blank lines after stripped `# ` setup blocks in the user guide. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
