Back to Trending
RepositoryPython
mgeier

mgeier/sphinx-last-updated-by-git

:watch: Get the "last updated" time for each Sphinx page from Git

58stars
12forks
4issues
0views

📦 Cập nhật tài liệu Sphinx từ lịch sử Git tự động

Một extension Sphinx nhỏ gọn lấy ngày cập nhật lần cuốcủa từng trang từ Git, kể cả file bao gồm và phụ thuộc khác.

Đây là một extension Sphinx nhỏ do người dùng GitHub mgeier phát triển. Thay vì cần cấu hình thủ công ngày cập nhật, extension này tự động truy xuất thờng tin từ lịch sử Git: dùng thời gian của commit cuốiùng sửa file (theo "author date") làm thời gian "last updated". Đặc biệt, nó còn kiểm tra cả các file được bao gồm hoặc dùng làm phụ thuộc — nếu chúng được cập nhật sau, thời gian trang sẽ dựa trên chúng.

✨ Điểm nổi bật

  • Lấy thời gian từ Git tự động: Dùng "author date" của commit cuối cùng sửa mỗi file làm thời gian cập nhật.
  • Kiểm tra file bao gồm và phụ thuộc: Nếu file nàó được cập nhật gần đây hộ, thời gian trang sẽ dựa trên file đó.
  • Tùy chọn thời gian địa phương hoặc múi giờ khác: Có thể thiết lập múi giờ bằng datetime.timezone hoặc chuỗi Babel như 'Pacific/Auckland'.
  • Tùy chọn meta tag HTML: Thời gian cập nhật được thêm dưới dạng thẻ <meta> trong HTML, có thể tắt bằng git_last_updated_metatags = False.
  • Hỗ trợ loại trừ file hoặc commit: Dùng git_exclude_patterns để bỏ qua file, hoặc git_exclude_commits để bỏ qua commit cụ thể.
  • Tùy chọn thời gian hợp nhất: Nếu muốn dựa trên thời gian merge thay vì thời gian soạn thảo, bật git_last_updated_when_merged = True.
  • Hỗ trợ file không theo dõi Git: Có thể lấy thời gian từ các file phụ thuộc nếu file chính chưa được theo dõi Git.

💡 Vì sao đáng chú ý

Thay vì phụ thuộc vào cấu hình thủ công hoặc công cụ bên ngoài, extension này tích hợp sẵn vào quy trình build Sphinx, tự động đồng bộ thời gian cập nhật từ Git. Phù hợp với dự án tài liệu lớn, nhiều file, cần cập nhật thời gian chính xác và tự động. Đặc biệt hữu ích khi dùng Read the Docs hoặc GitHub Actions — chỉ cần cấu hình fetch-depth: 0 để tránh lỗi clone không đầy đủ.


#Sphinx #Git #Documentation #Python #TiniX

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
spatialaudio/nbsphinx

:ledger: Sphinx source parser for Jupyter notebooks

472
Oct 6, 2026
RepositoryPython
mgaitan/sphinxcontrib-mermaid

Mermaid diagrams in yours sphinx powered docs

413
Oct 1, 2026
RepositoryPython
lnoor/sphinx-jsonschema

A Sphinx extension to display a JSON Schema

83
Oct 25, 2026
RepositoryPython
useblocks/sphinx-simplepdf

A simple PDF builder for Sphinx documentations

55
Apr 28, 2026
RepositoryPython
sphinx-doc/sphinxcontrib-django

This is a sphinx extension which improves the documentation of Django apps.

51
Jul 20, 2026
RepositoryPython
sphinx-contrib/datatemplates

Sphinx plugin for generating RST on the fly from data files and templates.

50
May 25, 2025
RepositoryHTML
ygzgxyz/awesome-sphinxdoc

Awesome Sphinxdoc is a curated collection of valuable resources for Sphinx

980
Oct 7, 2025
RepositoryCSS
aedanbricker/sphinx_rtd_dark_mode

Adds a toggleable dark mode to the Read the Docs theme for Sphinx.

74
Sep 9, 2026
RepositoryPython
readthedocs/readthedocs.org

The source code that powers readthedocs.org

8.4k
Oct 25, 2026