Sphinx 1.4 發布,Python 開發程序文檔工具

2020-12-25 開源中國

Python 開發的程序文檔工具 —— Sphinx 發布 1.4 版本,Sphinx 簡單來說,是一個文檔生成工具,用於把reStructuredText 格式的源文件生成諸如HTML, PDF, LaTex一類的格式。編輯者無須親自處理文本的格式, 程序會自動根據源文件裡的設置產生格式, 以及自動生成章節連結等工作。

新版本改進記錄包括:

Incompatible changes
--------------------
* Drop ``PorterStemmer`` package support. Use ``PyStemmer`` instead of ``PorterStemmer``
  to accelerate stemming.
* sphinx_rtd_theme has become optional. Please install it manually.
  Refs #2087, #2086, #1845 and #2097. Thanks to Victor Zverovich.
* #2231: Use DUrole instead of DUspan for custom roles in LaTeX writer. It enables to take
  title of roles as an argument of custom macros.
* #2022: 'Thumbs.db' and '.DS_Store' are added to `exclude_patterns` default values in
  conf.py that will be provided on sphinx-quickstart.
* #2027, #2208: The ``html_title`` accepts string values only. And The None value cannot be
  accepted.
* ``sphinx.ext.graphviz``: show graph image in inline by default
* #2060, #2224: The ``manpage`` role now generate ``sphinx.addnodes.manpage`` node instead
  of ``sphinx.addnodes.literal_emphasis`` node.
* #2022: :confval:`html_extra_path` also copies dotfiles in the extra directory, and
  refers to :confval:`exclude_patterns` to exclude extra files and directories.
* #2300: enhance autoclass:: to use the docstring of __new__ if __init__ method's is missing
  of empty
* #2251: Previously, under glossary directives, multiple terms for one definition are
  converted into single ``term`` node and the each terms in the term node are separated
  by ``termsep`` node. In new implementation, each terms are converted into individual
  ``term`` nodes and ``termsep`` node is removed.
  By this change, output layout of every builders are changed a bit.
* The default highlight language is now Python 3.  This means that source code
  is highlighted as Python 3 (which is mostly a superset of Python 2), and no
  parsing is attempted to distinguish valid code.  To get the old behavior back,
  add ``highlight_language = "python"`` to conf.py.
* `Locale Date Markup Language
  <http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns>`_ like
  ``"MMMM dd, YYYY"`` is default format for `today_fmt` and `html_last_updated_fmt`.
  However strftime format like ``"%B %d, %Y"`` is also supported for backward
  compatibility until Sphinx-1.5. Later format will be disabled from Sphinx-1.5.
* #2327: `latex_use_parts` is deprecated now. Use `latex_toplevel_sectioning` instead.
* #2337: Use ``\url{URL}`` macro instead of ``\href{URL}{URL}`` in LaTeX writer.
* #1498: manpage writer: don't make whole of item in definition list bold if it includes strong node.
* #582: Remove hint message from quick search box for html output.
* #2378: Sphinx now bundles newfloat.sty

Features added
--------------
* #2092: add todo directive support in napoleon package.
* #1962: when adding directives, roles or nodes from an extension, warn if such
  an element is already present (built-in or added by another extension).
* #1909: Add "doc" references to Intersphinx inventories.
* C++ type alias support (e.g., ``.. type:: T = int``).
* C++ template support for classes, functions, type aliases, and variables (#1729, #1314).
* C++, added new scope management directives ``namespace-push`` and ``namespace-pop``.
* #1970: Keyboard shortcuts to navigate Next and Previous topics
* Intersphinx: Added support for fetching Intersphinx inventories with URLs
  using HTTP basic auth.
* C++, added support for template parameter in function info field lists.
* C++, added support for pointers to member (function).
* #2113: Allow ``:class:`` option to code-block directive.
* #2192: Imgmath (pngmath with svg support).
* #2200: Support XeTeX and LuaTeX for the LaTeX builder.
* #1906: Use xcolor over color for \fcolorbox where available for LaTeX output.
* #2216: Texinputs makefile improvements.
* #2170: Support for Chinese language search index.
* #2214: Add sphinx.ext.githubpages to publish the docs on GitHub Pages
* #1030: Make page reference names for latex_show_pagerefs translatable
* #2162: Add Sphinx.add_source_parser() to add source_suffix and source_parsers from extension
* #2207: Add sphinx.parsers.Parser class; a base class for new parsers
* #656: Add ``graphviz_dot`` option to graphviz directives to switch the ``dot`` command
* #1939: Added the ``dummy`` builder: syntax check without output.
* #2230: Add ``math_number_all`` option to number all displayed math in math extensions
* #2235: ``needs_sphinx`` supports micro version comparison
* #2282: Add "language" attribute to html tag in the "basic" theme
* #1779: Add EPUB 3 builder
* #1751: Add :confval:`todo_link_only` to avoid file path and line indication on
  :rst:dir:`todolist`. Thanks to Francesco Montesano.
* #2199: Use ``imagesize`` package to obtain size of images.
* #1099: Add configurable retries to the linkcheck builder. Thanks to Alex Gaynor.
  Also don't check anchors starting with ``!``.
* #2300: enhance autoclass:: to use the docstring of __new__ if __init__ method's is missing
  of empty
* #1858: Add Sphinx.add_enumerable_node() to add enumerable nodes for numfig feature
* #1286, #2099: Add ``sphinx.ext.autosectionlabel`` extension to allow reference
  sections using its title. Thanks to Tadhg O'Higgins.
* #1854: Allow to choose Janome for Japanese splitter.
* #1853: support custom text splitter on html search with ``language='ja'``.
* #2320: classifier of glossary terms can be used for index entries grouping key.
  The classifier also be used for translation. See also :ref:`glossary-directive`.
* #2308: Define ``\tablecontinued`` macro to redefine the style of continued label for
  longtables.
* Select an image by similarity if multiple images are globbed by ``.. image:: filename.*``
* #1921: Support figure substitutions by :confval:`language` and :confval:`figure_language_filename`
* #2245: Add ``latex_elements["passoptionstopackages"]`` option to call PassOptionsToPackages
  in early stage of preambles.
* #2340: Math extension: support alignment of multiple equations for MathJAX.
* #2338: Define ``\titleref`` macro to redefine the style of ``title-reference`` roles.
* Define ``\menuselection`` and ``\accelerator`` macros to redefine the style of `menuselection` roles.
* Define ``\crossref`` macro to redefine the style of references
* #2301: Texts in the classic html theme should be hyphenated.
* #2355: Define ``\termref`` macro to redefine the style of ``term`` roles.
* Add :confval:`suppress_warnings` to suppress arbitrary warning message (experimental)
* #2229: Fix no warning is given for unknown options
* #2327: Add `latex_toplevel_sectioning` to switch the top level sectioning of LaTeX document.

Bugs fixed
----------
* #1913: C++, fix assert bug for enumerators in next-to-global and global scope.
* C++, fix parsing of 'signed char' and 'unsigned char' as types.
* C++, add missing support for 'friend' functions.
* C++, add missing support for virtual base classes (thanks to Rapptz).
* C++, add support for final classes.
* C++, fix parsing of types prefixed with 'enum'.
* #2023: Dutch search support uses Danish stemming info.
* C++, add support for user-defined literals.
* #1804: Now html output wraps overflowed long-line-text in the sidebar. Thanks to
  Hassen ben tanfous.
* #2183: Fix porterstemmer causes ``make json`` to fail.
* #1899: Ensure list is sent to OptParse.
* #2164: Fix wrong check for pdftex inside sphinx.sty (for graphicx package option).
* #2165, #2218: Remove faulty and non-need conditional from sphinx.sty.
* Fix broken LaTeX code is generated if unknown language is given
* #1944: Fix rst_prolog breaks file-wide metadata
* #2074: make gettext should use canonical relative paths for .pot. Thanks to
  anatoly techtonik.
* #2311: Fix sphinx.ext.inheritance_diagram raises AttributeError
* #2251: Line breaks in .rst files are transferred to .pot files in a wrong way.
* #794: Fix date formatting in latex output is not localized
* Remove ``image/gif`` from supported_image_types of LaTeX writer (#2272)
* Fix ValueError is raised if LANGUAGE is empty string
* Fix unpack warning is shown when the directives generated from ``Sphinx.add_crossref_type`` is used
* The default highlight language is now ``default``.  This means that source code
  is highlighted as Python 3 (which is mostly a superset of Python 2) if possible.
  To get the old behavior back, add ``highlight_language = "python"`` to conf.py.
* #2329: Refresh environment forcely if source directory has changed.
* #2331: Fix code-blocks are filled by block in dvi; remove ``xcdraw`` option from xcolor package
* Fix the confval type checker emits warnings if unicode is given to confvals which expects string value
* #2360: Fix numref in LaTeX output is broken
* #2361: Fix additional paragraphs inside the "compound" directive are indented
* #2364: Fix KeyError 'rootSymbol' on Sphinx upgrade from older version.
* #2348: Move amsmath and amssymb to before fontpkg on LaTeX writer.
* #2368: Ignore emacs lock files like ``.#foo.rst`` by default.
* #2262: literal_block and its caption has been separated by pagebreak in LaTeX output.
* #2319: Fix table counter is overrided by code-block's in LaTeX.  Thanks to jfbu.
* Fix unpack warning if combinated with 3rd party domain extensions.
* #1153: Fix figures in sidebar causes latex build error.
* #2358: Fix user-preamble could not override the tocdepth definition.
* #2358: Redece tocdepth if ``part`` or ``chapter`` is used for top_sectionlevel.
* #2351: Fix footnote spacing
* #2363: Fix ``toctree()`` in templates generates broken links in SingleHTMLBuilder.
* #2366: Fix empty hyperref is generated on toctree in HTML builder.

Documentation
-------------

* #1757: Fix for usage of :confval:`html_last_updated_fmt`. Thanks to Ralf Hemmecke.

相關焦點

  • Python Sphinx 生成簡潔大方的文檔
    Sphinx 是一種工具,是一個有趣 python 的第三方庫,它允許程式設計師以純文本格式編寫文檔,Spninx 可以輕鬆生成各種格式的輸出,比如 html,pfd,等等。純文本的文檔方便使用版本管理工具進行跟蹤。純文本文檔對不同系統之間的協作者也非常有用,純文本是當前可以採用的最便捷的格式之一,不然 markdown 格式咋那麼火呢,不是沒有道理的。程式設計師最討厭的兩件事:正經寫文檔確實麻煩,為啥麻煩呢?
  • 使用IDLE開發工具開發Python程序
    這節課是少兒Python編程與數學的第4節課,在這節課中我將和同學們一起了解IDLE開發工具,通過這節課的學習,同學們會掌握IDLE開發工具的基本使用方法。這節的課程內容是實踐課,請同學們和老師一起完成這節實踐課的內容。實踐內容有兩項,第一項實踐是了解IDLE開發工具,第二項實踐是使用IDLE開發工具進行算式計算。
  • 使用 Sphinx 將個人筆記變成文檔的形狀~
    使用 Nginx 掛載 gitbook 編譯的連結可以參考我以前的推文:開發文檔加載不再卡頓,億點點提升使用 Sphinx 記筆記環境搭建首先安裝必要的包,我用的 python 環境是 Anaconda,日常不激活 conda 環境而是直接用。安裝包用匹配即可,用 conda 管理環境反而麻煩(在不需要做環境隔離的情況下)。
  • 【Python】RST文件打開——以torchtext官方github文檔為例
    1 背景近期在學習torchtext相關內容,但是當前網絡上相關的中文文檔較少,一些博文描述的不是很詳細
  • Python編程:開發工具(IDE)大匯總(附官方下載)
    最近有多位讀者留言,諮詢更便捷、高效的python編程開發工具(IDE),本文就給大家介紹四款業內常用的python軟體開發工具,並簡單介紹下每款軟體的特點,便於讀者按需選擇合適的學習軟體!IDE,是一款Web應用程式,便於創建和編寫文檔等操作,支持實時編寫並運行代碼、方程式,同時支持可視化圖像輸出等等,其安裝與啟動方式很簡單:安裝python,請參考往期視頻教程:
  • 零基礎Python入門教程 - 第三節 搭建Python開發環境
    1.安裝Python運行環境首先,我們要去Python官網(https://www.python.org/downloads/windows/)下載Python安裝包,注意選擇Windows版本。下載好了以後直接雙擊運行安裝即可。
  • Python基礎之開發環境IDLE
    1.Python基本開發環境IDLEIDLE由Python官方提供 適用於小規模程序開發其具有以下特點:- Python官方環境:Python解釋器 + IDLE開發環境- 輕量級:只有幾十MB大小,使用靈活- 功能豐富:編輯器+交互環境+標準庫+庫安裝工具打開Python官網後如圖所示:點擊下載即可下載最新版python安裝包。
  • 最新 | Python 官方中文文檔正式發布!
    Python 官方文檔終於發布中文版了!受英語困擾的小夥伴終於可以更輕鬆地閱讀官方文檔了。嘗鮮地址:https://docs.python.org/zh-cn/3/最新發布的這個 Python 官方文檔可以自由選擇語言
  • python web學習路線知識點分享!
    代碼: pep8,代碼組織,文檔注釋,TDD,敏捷等。markdown/sphinx/docstring/readthedoc等(使用vim的話推薦python-mode插件,或者直接用IDE工具pycharm)相關框架(庫):django/flask/tornado/requests/sqlalchemy/unittest/celery等等資料庫:
  • 推薦一些能提高生產力的 Python 庫
    所以這裡就不再針對於一些特殊的場景推薦了,如一些 Web開發庫、網絡請求庫、數據操作庫、數據分析庫、機器分析庫等等。下面主要羅列一些適用範圍和方向較廣,對於一些基礎設施的建設比較有用,能在多數場景下提高 Python 生產力的庫,描述比較簡單,主要是提供一個列表,僅供參考哈。
  • Python Web 開發哪家強?
    它的開發基於「內置電池的方法」(譯者註:Django 自帶全套工具,可以開箱即用),使開發人員無需第三方庫和工具即可創建網站。隨著 2005 年 7 月 15 日的第一次發布, Django 由 Django 軟體基金會(DSF)開發和管理。它是免費且開源的,已經發布了許多個版本。Flask
  • 常用的十大 python 圖像處理工具
    1.scikit-imagescikit-image是一個開源的Python包,適用於numpy數組。它實現了用於研究,教育和工業應用的算法和實用工具。即使是那些剛接觸Python生態系統的人,它也是一個相當簡單直接的庫。此代碼是由活躍的志願者社區編寫的,具有高質量和同行評審的性質。
  • Python開發簡單爬蟲【學習資料總結】
    開發爬蟲步驟 python語言基礎:(帶你熟悉python語言的特性,學會使用python開發環境,使用python開發一些簡單的案例)
  • 慢步python,教你怎麼通過python編程來修改word文檔內標題
    這樣慢步有個設想,通過python創造一個小型程序,進行word文檔的批量修改。現在先實現第一個簡單的功能:修改word文檔內標題。先創建有一個Word文檔。慢步隨便搜索了一個通知,複製粘貼到新建的word文檔中,保存為標題的名字。文檔暫時保存在桌面吧。
  • smart-doc 1.9.4 發布,Java 零註解 API 文檔生成工具
    smart-doc完全基於接口源碼分析來生成接口文檔,完全做到零註解侵入,你只需要按照java標準注釋編寫,smart-doc就能幫你生成一個簡易明了的markdown 或是一個像GitBook樣式的靜態html文檔。如果你已經厭倦了swagger等文檔工具的無數註解和強侵入汙染,那請擁抱smart-doc吧!
  • 10個Python圖像處理工具,非常全了!
    這是因為它作為一種科學程式語言越來越受歡迎,而且在其生態系統中有許多最先進的圖像處理工具可以免費使用。我們來看一些用於圖像處理任務的常用Python庫。1. scikit Imagescikit-image是一個開源的Python包,可以使用 numpy 數組。它實現了用於研究、教育和工業應用的算法和實用程序。
  • 令人讚嘆的8個Python新手工具!
    1、 IDLEIDLE直譯過來就是集成開發與學習環境的意思,一般安裝 Python 時也會默認安裝 IDLE。每個語言都可以有自己的IDLE。它讓Python的入門變得簡單,對於沒什麼基礎的人寫就對了。
  • 教你怎樣用python進行語音識別
    speech recognition對於python這一非常成熟的膠水語言,在網上找一些現成的工具包真的不是一個太難的問題。這裡講一下如何在不聯網的情況下,依然可以通過python來將語音文件轉換成文字。這裡用到的包為sphinx,sphinx是由美國卡內基梅隆大學開發的大詞彙量、非特定人、連續英語語音識別系統。安裝 sphinx我本人所用的環境為ubuntu。
  • 如何在Visual Studio開發工具安裝python庫
    >技術pythonDjango在python語言開發工具的pycharm中,可以安裝第三方庫。那麼,在Visual Studio開發工具中,如何安裝python第三方庫呢?下面利用實例說明:操作步驟:1、打開Visual Studio 2019開發工具,創建python項目
  • 加速程序開發 Python整合C語言模塊
    而作為軟體開發的傳統程式語言——C語言,卻能在這些問題上很好地彌補Python語言的不足。因此,本文通過實例研究如何在Python程序中整合既有的C語言模塊,包括用C語言編寫的源程序和動態連結庫等,從而充分發揮Python語言和C語言各自的優勢。Python語言的特點Python作為一門程序開發語言,被越來越多地運用到快速程序開發。