Skip to content

fix: rebase links in translated documentation - #5093

Open
AnvitDevadiga wants to merge 2 commits into
openai:mainfrom
AnvitDevadiga:fix/translated-doc-relative-links
Open

AnvitDevadiga wants to merge 2 commits into
openai:mainfrom
AnvitDevadiga:fix/translated-doc-relative-links

Conversation

@AnvitDevadiga

Copy link
Copy Markdown

Closes #5092

Summary

  • Rebase relative Markdown links and images when translating pages into locale subdirectories.
  • Preserve anchors, external URLs, local anchors, and fenced-code examples.
  • Apply the same repair when refreshing an existing translation so generated files stay correct.
  • Add regression tests for nested paths, anchors, images, external links, and code fences.

Verification

  • .venv/bin/pytest -q tests/docs/test_translate_docs.py
  • .venv/bin/ruff check docs/scripts/translate_docs.py tests/docs/test_translate_docs.py

@AnvitDevadiga
AnvitDevadiga requested review from a team, rm-openai and seratch as code owners September 19, 2026 06:23

@sylvesterkaczmarek sylvesterkaczmarek 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.

The fence tracking only remembers the first 3 chars. A valid four-backtick fence can contain a literal three-backtick line, which this treats as the close, so links later in that code block get rewritten. Could this keep the actual fence marker/length and only close on a fence at least that long?

@AnvitDevadiga

Copy link
Copy Markdown
Author

Thanks for catching this edge case. I’ve updated the parser to preserve the full fence character and length, added a four-backtick regression test, and pushed the fix in commit 9bc530d. The focused tests and lint checks pass.

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

Rechecked 9bc530d. Fence tracking now preserves both the fence character and its full opening length, and only a same-character fence at least that long closes the block. The four-backtick regression covers the exact case I raised. My concern is resolved.

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.

Generated translated docs (ja/ko/zh) contain ~30 broken relative links (translate_docs.py copies English link targets verbatim)

2 participants