github.com/imran-kn/cilium-fork@v1.6.9/Documentation/_themes/sphinx_rtd_theme/README.rst (about)

     1  .. _readthedocs.org: http://www.readthedocs.org
     2  .. _bower: http://www.bower.io
     3  .. _sphinx: http://www.sphinx-doc.org
     4  .. _compass: http://www.compass-style.org
     5  .. _sass: http://www.sass-lang.com
     6  .. _wyrm: http://www.github.com/snide/wyrm/
     7  .. _grunt: http://www.gruntjs.com
     8  .. _node: http://www.nodejs.com
     9  .. _demo: http://docs.readthedocs.org
    10  .. _hidden: http://sphinx-doc.org/markup/toctree.html
    11  
    12  .. image:: https://img.shields.io/pypi/v/sphinx_rtd_theme.svg
    13     :target: https://pypi.python.org/pypi/sphinx_rtd_theme
    14  .. image:: https://travis-ci.org/rtfd/sphinx_rtd_theme.svg?branch=master
    15     :target: https://travis-ci.org/rtfd/sphinx_rtd_theme
    16  .. image:: https://img.shields.io/pypi/l/sphinx_rtd_theme.svg
    17     :target: https://pypi.python.org/pypi/sphinx_rtd_theme/
    18     :alt: license
    19  
    20  **************************
    21  Read the Docs Sphinx Theme
    22  **************************
    23  
    24  .. contents:: 
    25  
    26  View a working demo_ over on readthedocs.org_.
    27  
    28  This is a mobile-friendly sphinx_ theme I made for readthedocs.org_.
    29  
    30  If you'd like to update the theme,
    31  please make your edits to the SASS files here,
    32  rather than the .css files on checked into the repo.
    33  
    34  .. image:: demo_docs/source/static/screen_mobile.png
    35      :width: 100%
    36  
    37  Installation
    38  ============
    39  
    40  Via package
    41  -----------
    42  
    43  Download the package or add it to your ``requirements.txt`` file:
    44  
    45  .. code:: bash
    46  
    47      pip install sphinx_rtd_theme
    48  
    49  In your ``conf.py`` file:
    50  
    51  .. code:: python
    52  
    53      import sphinx_rtd_theme
    54      html_theme = "sphinx_rtd_theme"
    55      html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
    56  
    57  or (since v0.2.5):
    58  
    59  .. code:: python
    60  
    61      html_theme = "sphinx_rtd_theme"
    62  
    63  Via git or download
    64  -------------------
    65  
    66  Symlink or subtree the ``sphinx_rtd_theme/sphinx_rtd_theme`` repository into your documentation at
    67  ``docs/_themes/sphinx_rtd_theme`` then add the following two settings to your Sphinx
    68  ``conf.py`` file:
    69  
    70  .. code:: python
    71  
    72      html_theme = "sphinx_rtd_theme"
    73      html_theme_path = ["_themes", ]
    74  
    75  Configuration
    76  =============
    77  
    78  You can configure different parts of the theme.
    79  
    80  Project-wide configuration
    81  --------------------------
    82  
    83  The theme's project-wide options are defined in the ``sphinx_rtd_theme/theme.conf``
    84  file of this repository, and can be defined in your project's ``conf.py`` via
    85  ``html_theme_options``. For example:
    86  
    87  .. code:: python
    88  
    89      html_theme_options = {
    90          'collapse_navigation': False,
    91          'display_version': False,
    92          'navigation_depth': 3,
    93      }
    94  
    95  The following options are available:
    96  
    97  * ``canonical_url`` This will specify a `canonical url <https://en.wikipedia.org/wiki/Canonical_link_element>`__
    98    to let search engines know they should give higher ranking to latest version of the docs.
    99    The url points to the root of the documentation and requires a trailing slash.
   100  
   101  Page-level configuration
   102  ------------------------
   103  
   104  Pages support metadata that changes how the theme renders.
   105  You can currently add the following:
   106  
   107  * ``:github_url:`` This will force the "Edit on GitHub" to the configured URL
   108  * ``:bitbucket_url:`` This will force the "Edit on Bitbucket" to the configured URL
   109  * ``:gitlab_url:`` This will force the "Edit on GitLab" to the configured URL
   110  
   111  Changelog
   112  =========
   113  
   114  master
   115  ------
   116  
   117  * Include fontawesome-webfont.woff2 in pip package
   118  * Updated wyrm_ and Font Awesome
   119  * Split multiple data types on different lines
   120  * Italicize ``.versionmodified``
   121  * Fix line number spacing to align with the code lines
   122  * Hide Edit links on auto created pages
   123  * Align ``.. centered::`` text to the center
   124  * Increase contrast for footnotes
   125  * Add language to the JS output variable
   126  * Include the lato italics font with the theme
   127  * Fix padding on field lists
   128  * Add setuptools entry point allowing to use ``sphinx_rtd_theme`` as
   129    Sphinx ``html_theme`` directly.
   130  
   131  v0.2.4
   132  ------
   133  
   134  * Yet another patch to deal with extra builders outside Spinx, such as the
   135    singlehtml builders from the Read the Docs Sphinx extension
   136  
   137  v0.2.3
   138  ------
   139  
   140  * Temporarily patch Sphinx issue with ``singlehtml`` builder by inspecting the
   141    builder in template.
   142  
   143  v0.2.2
   144  ------
   145  
   146  * Roll back toctree fix in 0.2.1 (#367). This didn't fix the issue and
   147    introduced another bug with toctrees display.
   148  
   149  v0.2.1
   150  ------
   151  
   152  * Add the ``rel`` HTML attribute to the footer links which point to
   153    the previous and next pages.
   154  * Fix toctree issue caused by Sphinx singlehtml builder (#367)
   155  
   156  v0.2.0
   157  ------
   158  
   159  * Adds the ``comments`` block after the ``body`` block in the template
   160  * Added "Edit on GitLab" support
   161  * Many bug fixes
   162  
   163  v0.1.10-alpha
   164  -------------
   165  
   166  .. note:: This is a pre-release version
   167  
   168  * Removes Sphinx dependency
   169  * Fixes hamburger on mobile display
   170  * Adds a ``body_begin`` block to the template
   171  * Add ``prev_next_buttons_location`` which can take the value ``bottom``,
   172    ``top``, ``both`` , ``None`` and will display the "Next" and "Previous"
   173    buttons accordingly
   174  
   175  v0.1.9
   176  ------
   177  
   178  * Intermittent scrollbar visibility bug fixed. This change introduces a
   179    backwards incompatible change to the theme's layout HTML. This should only be
   180    a problem for derivative themes that have overridden styling of nav elements
   181    using direct decendant selectors. See `#215`_ for more information.
   182  * Safari overscroll bug fixed
   183  * Version added to the nav header
   184  * Revision id was added to the documentation footer if you are using RTD
   185  * An extra block, ``extrafooter`` was added to allow extra content in the
   186    document footer block
   187  * Fixed modernizr URL
   188  * Small display style changes on code blocks, figure captions, and nav elements
   189  
   190  .. _#215: https://github.com/rtfd/sphinx_rtd_theme/pull/215
   191  
   192  v0.1.8
   193  ------
   194  
   195  * Start keeping changelog :)
   196  * Support for third and fourth level headers in the sidebar
   197  * Add support for Sphinx 1.3
   198  * Add sidebar headers for :caption: in Sphinx toctree
   199  * Clean up sidebar scrolling behavior so it never scrolls out of view
   200  
   201  How the Table of Contents builds
   202  ================================
   203  
   204  Currently the left menu will build based upon any ``toctree(s)`` defined in your ``index.rst`` file.
   205  It outputs 2 levels of depth, which should give your visitors a high level of access to your
   206  docs. If no toctrees are set the theme reverts to sphinx's usual local toctree.
   207  
   208  It's important to note that if you don't follow the same styling for your rST headers across
   209  your documents, the toctree will misbuild, and the resulting menu might not show the correct
   210  depth when it renders.
   211  
   212  Also note that the table of contents is set with ``includehidden=true``. This allows you
   213  to set a hidden toc in your index file with the hidden_ property that will allow you
   214  to build a toc without it rendering in your index.
   215  
   216  By default, the navigation will "stick" to the screen as you scroll. However if your toc
   217  is vertically too large, it will revert to static positioning. To disable the sticky nav
   218  altogether change the setting in ``conf.py``.
   219  
   220  Contributing or modifying the theme
   221  ===================================
   222  
   223  The sphinx_rtd_theme is primarily a sass_ project that requires a few other sass libraries. I'm
   224  using bower_ to manage these dependencies and sass_ to build the css. The good news is
   225  I have a very nice set of grunt_ operations that will not only load these dependencies, but watch
   226  for changes, rebuild the sphinx demo docs and build a distributable version of the theme.
   227  The bad news is this means you'll need to set up your environment similar to that
   228  of a front-end developer (vs. that of a python developer). That means installing node and ruby.
   229  
   230  Set up your environment
   231  -----------------------
   232  
   233  #. Install sphinx_ into a virtual environment.
   234  
   235     .. code:: bash
   236     
   237         pip install sphinx sphinxcontrib-httpdomain
   238  
   239  #. Install sass.
   240  
   241     .. code:: bash
   242  
   243         gem install sass
   244  
   245  #. Install node, bower, grunt, and theme dependencies.
   246  
   247     .. code:: bash
   248  
   249         # Install node
   250         brew install node
   251  
   252         # Install bower and grunt
   253         npm install -g bower grunt-cli
   254  
   255         # Now that everything is installed, let's install the theme dependencies.
   256         npm install
   257  
   258  Now that our environment is set up, make sure you're in your virtual environment, go to
   259  this repository in your terminal and run grunt:
   260  
   261  .. code::
   262  
   263      grunt
   264  
   265  This default task will do the following **very cool things that make it worth the trouble**:
   266  
   267  #. Install and update any bower dependencies.
   268  #. Run sphinx and build new docs.
   269  #. Watch for changes to the sass files and build css from the changes.
   270  #. Rebuild the sphinx docs anytime it notices a change to ``.rst``, ``.html``, ``.js``
   271     or ``.css`` files.
   272  
   273  Before you create an issue
   274  --------------------------
   275  
   276  I don't have a lot of time to maintain this project due to other responsibilities.
   277  I know there are a lot of Python engineers out there that can't code sass / css and
   278  are unable to submit pull requests. That said, submitting random style bugs without
   279  at least providing sample documentation that replicates your problem is a good
   280  way for me to ignore your request. RST unfortunately can spit out a lot of things
   281  in a lot of ways. I don't have time to research your problem for you, but I do
   282  have time to fix the actual styling issue if you can replicate the problem for me.
   283  
   284  Releasing the Theme
   285  ===================
   286  
   287  When you release a new version,
   288  you should do the following:
   289  
   290  #. Bump the version in ``sphinx_rtd_theme/__init__.py`` – we try to follow `semver <http://semver.org/>`_, so be careful with breaking changes.
   291  #. Run a ``grunt build`` to rebuild all the theme assets.
   292  #. Commit that change.
   293  #. Tag the release in git: ``git tag $NEW_VERSION``.
   294  #. Push the tag to GitHub: ``git push --tags origin``.
   295  #. Upload the package to PyPI: ``python setup.py sdist bdist_wheel upload``.
   296  #. In the ``readthedocs.org`` repo, edit the ``bower.json`` file to point at the correct version (``sphinx-rtd-theme": "https://github.com/rtfd/sphinx-rtd-theme.git#$NEW_VERSION"``).
   297  #. In the ``readthedocs.org`` repo, run ``gulp build`` to update the distributed theme files.
   298  
   299  TODO
   300  ====
   301  
   302  * Separate some sass variables at the theme level so you can overwrite some basic colors.