SlideShare a Scribd company logo
7
Most read
8
Most read
9
Most read
Documenting with Sphinx
ReStructured Text to HTML
Authoring
Workflow
Write RST using any 'text' editor
Compile RST to HTML using
Sphinx
Host HTML using any web server
ReStructured
Text
• A plain text format
• Also known as RST
• Authored using plain-text editors
• Markdown is used for formatting
• Compiles into HTML
• Intro to simple formatting options at
https://en.wikipedia.org/wiki/ReStructuredText#Ex
amples_of_reST_markup
Basic Formatting
First Heading
=============
Sub-heading
-----------
Third Heading
~~~~~~~~~~~~~
Paragraphs are separated
by a blank line.
Two spaces at the end of
a line produces a line
break.
*text* for emphasis
(italics)
**text** for strong
emphasis (boldface)
``text`` for code
samples.
* this is
* a list
* with a nested list
* and some subitems
* and here the parent list
continues
1. This is a numbered list.
2. It has two items too.
#. This is a numbered list.
#. It has two items too.
More Formatting
.. This is a comment.
.. This whole indented
block is a comment.
Still in the comment.
.. image:: path/to/image.png
.. raw:: html
<div>This is raw HTML</div>
This is a paragraph that contains `a link`_.
.. _a link: https://domain.invalid/
:: some literal text
This may also be used inline at the end of a paragraph, like so::
some more literal text
Tables
+------------------------+------------+----------+----------+
| Header row, column 1 | Header 2 | Header 3 | Header 4 |
| (header rows optional) | | | |
+========================+============+==========+==========+
| body row 1, column 1 | column 2 | column 3 | column 4 |
+------------------------+------------+----------+----------+
| body row 2 | ... | ... | |
+------------------------+------------+----------+----------+
===== ===== =======
A B A and B
===== ===== =======
False False False
True False False
False True False
True True True
===== ===== =======
Other supported Table formats:
CSV Table:
https://docutils.sourceforge.io/docs/ref/rst/directives.html#csv-table
List Table:
https://docutils.sourceforge.io/docs/ref/rst/directives.html#list-table
Cautions
Use a plain-text
editor only
• Notepad++, Vim
etc.
1
Don’t use
WYSIWYG
editors
• MS word, textEdit,
Notepad etc.
2
Use uniform
underlines for
headings in all
files
3
Keep track for
indentation,
whitespace &
blank-lines in rst
file
4
Sphinx
• Tool that converts rst to HTML
• Multiple skins (themes) available
• Plugins available for extending
• Complete list of formatting options supported by sphinx
https://www.sphinx-
doc.org/en/master/usage/restructuredtext/basics.html
One-time
Setup
Customize customize conf.py
Create Create Documentation Structure
Install Install required Sphinx plugins e.g. rtdtheme
Install Install Sphinx in virtual env
Create Create Python virtual env (best practice)
Install Install Python
Additional Best Practice – Use GIT
• Version control source files
• rst files
• conf.py
• GIT is common version control system
• Keeps the data safe
• Allows to pull old versions
• Allow seamless collaboration
More about source control and Git at
https://www.slideshare.net/AkshayMathur7/git-workshop-26088242
Resources
• Down & Install Python - No need to learn Python!
• https://www.python.org/downloads/
• Download & Install GIT [this also provides Linux shell on Windows]
• https://git-scm.com/downloads
• Create and activate virtual env
• https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments
• Install Sphinx from pypi
• pip install -U sphinx
• https://www.sphinx-doc.org/en/master/usage/installation.html#installation-from-
pypi
• Install RTD Theme
• pip install sphinx_rtd_theme
• https://pypi.org/project/sphinx-rtd-theme/
• Theme config: https://sphinx-rtd-theme.readthedocs.io/en/stable/configuring.html
Resources
• Setup documentation source structure
• sphinx-quickstart
• https://www.sphinx-doc.org/en/master/usage/quickstart.html#setting-up-
the-documentation-sources
• Build Configuration file [conf.py]
• The file is generated with documentation source structure
• Options in file have include description
• https://www.sphinx-doc.org/en/master/usage/configuration.html
• Building [converting RST to HTML]
• sphinx-build sourcedir builddir
• https://www.sphinx-doc.org/en/master/usage/quickstart.html#running-the-
build
Documentation with Sphinx

More Related Content

PPTX
Basics of JAVA programming
PPTX
Project Documentation with Sphinx (or, How I Learned to Stop Worrying and Lov...
PPTX
Java Server Pages(jsp)
PPTX
Socket programming in Java (PPTX)
PPTX
Unit - 1: ASP.NET Basic
PPTX
Jsp presentation
PDF
C++ Restrictions for Game Programming.
PDF
Chapitre-4-Programmation-réseau-avec-les-sockets.pdf
Basics of JAVA programming
Project Documentation with Sphinx (or, How I Learned to Stop Worrying and Lov...
Java Server Pages(jsp)
Socket programming in Java (PPTX)
Unit - 1: ASP.NET Basic
Jsp presentation
C++ Restrictions for Game Programming.
Chapitre-4-Programmation-réseau-avec-les-sockets.pdf

What's hot (20)

PPSX
HTML5 - Forms
PDF
Java IO
PDF
Introduction to Java Programming
PPTX
Exception handling.pptx
PPT
C programming for Computing Techniques
PPTX
Syntax Directed Definition (SDD) .pptx
PPTX
What Is Express JS?
PPT
Custom Controls in ASP.net
PDF
R Tanenbaum .Net Developer August 2010
PPT
ADO.NET Entity Framework
PPT
Php Presentation
PPSX
Complete C programming Language Course
PPT
Packages in java
PPTX
Input processing and output in Python
PDF
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
PDF
TOC 8 | Derivation, Parse Tree & Ambiguity Check
PPTX
Web Standards And Protocols
PPTX
Introduction to java
PPTX
Introduction to php
HTML5 - Forms
Java IO
Introduction to Java Programming
Exception handling.pptx
C programming for Computing Techniques
Syntax Directed Definition (SDD) .pptx
What Is Express JS?
Custom Controls in ASP.net
R Tanenbaum .Net Developer August 2010
ADO.NET Entity Framework
Php Presentation
Complete C programming Language Course
Packages in java
Input processing and output in Python
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
TOC 8 | Derivation, Parse Tree & Ambiguity Check
Web Standards And Protocols
Introduction to java
Introduction to php
Ad

Similar to Documentation with Sphinx (8)

KEY
Sphinx-quickstart
PPTX
Markup languages and warp-speed documentation
PDF
Lois Patterson: Markup Languages and Warp-Speed Documentation
PPTX
Moving from Publican to Read The Docs
PDF
cauldron-2022-docs-bof at gcc cauldron in 2022
PPTX
Life with Sphinx 2012 #sphinxconjp
PDF
sphinx demo
PDF
Scale2016
Sphinx-quickstart
Markup languages and warp-speed documentation
Lois Patterson: Markup Languages and Warp-Speed Documentation
Moving from Publican to Read The Docs
cauldron-2022-docs-bof at gcc cauldron in 2022
Life with Sphinx 2012 #sphinxconjp
sphinx demo
Scale2016
Ad

More from Akshay Mathur (20)

PPTX
Kubernetes Journey of a Large FinTech
PPTX
Security and Observability of Application Traffic in Kubernetes
PPTX
Enhanced Security and Visibility for Microservices Applications
PPTX
Considerations for East-West Traffic Security and Analytics for Kubernetes En...
PPTX
Kubernetes as Orchestrator for A10 Lightning Controller
PPTX
Cloud Bursting with A10 Lightning ADS
PPTX
Shared Security Responsibility Model of AWS
PPTX
Techniques for scaling application with security and visibility in cloud
PPTX
Introduction to Node js
PPTX
Object Oriented Programing in JavaScript
PPTX
Getting Started with Angular JS
PDF
Releasing Software Without Testing Team
PPTX
Getting Started with jQuery
PPTX
CoffeeScript
PPTX
Creating Single Page Web App using Backbone JS
PPTX
Getting Started with Web
PPTX
Getting Started with Javascript
PPTX
Using Google App Engine Python
PPTX
Working with GIT
PPTX
Testing Single Page Webapp
Kubernetes Journey of a Large FinTech
Security and Observability of Application Traffic in Kubernetes
Enhanced Security and Visibility for Microservices Applications
Considerations for East-West Traffic Security and Analytics for Kubernetes En...
Kubernetes as Orchestrator for A10 Lightning Controller
Cloud Bursting with A10 Lightning ADS
Shared Security Responsibility Model of AWS
Techniques for scaling application with security and visibility in cloud
Introduction to Node js
Object Oriented Programing in JavaScript
Getting Started with Angular JS
Releasing Software Without Testing Team
Getting Started with jQuery
CoffeeScript
Creating Single Page Web App using Backbone JS
Getting Started with Web
Getting Started with Javascript
Using Google App Engine Python
Working with GIT
Testing Single Page Webapp

Recently uploaded (20)

PPTX
Punjabi_Music_KayD_ FINAL 2025 .pptx
PDF
Modernizing IT for the age of AI - Jason Aloia, Freshworks
PDF
Performance-Driven Web Design-Fast, Smart & Scalable Web Design
PDF
AI Strategy That Scales - Dan Banas, AI, Strategy, Analytics Consulting
PPTX
"Advertising & Marketing: Insights from Firoze Kohli’s Strategic Playbook"
PDF
Content Marketing Used By Travel Companies
PPTX
Fix or Redesign it? Plan before you Blow Your Budget
PDF
Beginners Guide on How to do Email Marketing
PDF
AI in Marketing Master Class - Sabrina Amjad, Vanbri Consulting
PDF
Marketing Automation Master Class - Michael Tucker, Benjamin Yeboah
PPTX
Find_Your_Georgia_Campaign_Proposal.pptx
PDF
What If - Tina McCormack Beaty, Chief Brand & Marketing Officer, SHRM
PPTX
Best Leather Products in Trichy | minibaskett.pptx
PDF
How to Get 1,000+ Leads Automatically – Proven System for 2025!
PDF
10 Best Practices for SEO Cross Linking.
PDF
Internet Marketing Company Report KUBS 2025 Spring.pdf
PDF
AI, Automation & SEO: The New Marketing PlaybooK - Eric Ritter, Digital Neighbor
PPTX
Social_Media_Marketing_Presentation.pptx
PDF
How Healthcare Advertising Agencies in Mumbai Use Digital To.pdf
PDF
AI & Automation: The Future of Marketing or the End of Creativity - Eric Ritt...
Punjabi_Music_KayD_ FINAL 2025 .pptx
Modernizing IT for the age of AI - Jason Aloia, Freshworks
Performance-Driven Web Design-Fast, Smart & Scalable Web Design
AI Strategy That Scales - Dan Banas, AI, Strategy, Analytics Consulting
"Advertising & Marketing: Insights from Firoze Kohli’s Strategic Playbook"
Content Marketing Used By Travel Companies
Fix or Redesign it? Plan before you Blow Your Budget
Beginners Guide on How to do Email Marketing
AI in Marketing Master Class - Sabrina Amjad, Vanbri Consulting
Marketing Automation Master Class - Michael Tucker, Benjamin Yeboah
Find_Your_Georgia_Campaign_Proposal.pptx
What If - Tina McCormack Beaty, Chief Brand & Marketing Officer, SHRM
Best Leather Products in Trichy | minibaskett.pptx
How to Get 1,000+ Leads Automatically – Proven System for 2025!
10 Best Practices for SEO Cross Linking.
Internet Marketing Company Report KUBS 2025 Spring.pdf
AI, Automation & SEO: The New Marketing PlaybooK - Eric Ritter, Digital Neighbor
Social_Media_Marketing_Presentation.pptx
How Healthcare Advertising Agencies in Mumbai Use Digital To.pdf
AI & Automation: The Future of Marketing or the End of Creativity - Eric Ritt...

Documentation with Sphinx

  • 2. Authoring Workflow Write RST using any 'text' editor Compile RST to HTML using Sphinx Host HTML using any web server
  • 3. ReStructured Text • A plain text format • Also known as RST • Authored using plain-text editors • Markdown is used for formatting • Compiles into HTML • Intro to simple formatting options at https://en.wikipedia.org/wiki/ReStructuredText#Ex amples_of_reST_markup
  • 4. Basic Formatting First Heading ============= Sub-heading ----------- Third Heading ~~~~~~~~~~~~~ Paragraphs are separated by a blank line. Two spaces at the end of a line produces a line break. *text* for emphasis (italics) **text** for strong emphasis (boldface) ``text`` for code samples. * this is * a list * with a nested list * and some subitems * and here the parent list continues 1. This is a numbered list. 2. It has two items too. #. This is a numbered list. #. It has two items too.
  • 5. More Formatting .. This is a comment. .. This whole indented block is a comment. Still in the comment. .. image:: path/to/image.png .. raw:: html <div>This is raw HTML</div> This is a paragraph that contains `a link`_. .. _a link: https://domain.invalid/ :: some literal text This may also be used inline at the end of a paragraph, like so:: some more literal text
  • 6. Tables +------------------------+------------+----------+----------+ | Header row, column 1 | Header 2 | Header 3 | Header 4 | | (header rows optional) | | | | +========================+============+==========+==========+ | body row 1, column 1 | column 2 | column 3 | column 4 | +------------------------+------------+----------+----------+ | body row 2 | ... | ... | | +------------------------+------------+----------+----------+ ===== ===== ======= A B A and B ===== ===== ======= False False False True False False False True False True True True ===== ===== ======= Other supported Table formats: CSV Table: https://docutils.sourceforge.io/docs/ref/rst/directives.html#csv-table List Table: https://docutils.sourceforge.io/docs/ref/rst/directives.html#list-table
  • 7. Cautions Use a plain-text editor only • Notepad++, Vim etc. 1 Don’t use WYSIWYG editors • MS word, textEdit, Notepad etc. 2 Use uniform underlines for headings in all files 3 Keep track for indentation, whitespace & blank-lines in rst file 4
  • 8. Sphinx • Tool that converts rst to HTML • Multiple skins (themes) available • Plugins available for extending • Complete list of formatting options supported by sphinx https://www.sphinx- doc.org/en/master/usage/restructuredtext/basics.html
  • 9. One-time Setup Customize customize conf.py Create Create Documentation Structure Install Install required Sphinx plugins e.g. rtdtheme Install Install Sphinx in virtual env Create Create Python virtual env (best practice) Install Install Python
  • 10. Additional Best Practice – Use GIT • Version control source files • rst files • conf.py • GIT is common version control system • Keeps the data safe • Allows to pull old versions • Allow seamless collaboration More about source control and Git at https://www.slideshare.net/AkshayMathur7/git-workshop-26088242
  • 11. Resources • Down & Install Python - No need to learn Python! • https://www.python.org/downloads/ • Download & Install GIT [this also provides Linux shell on Windows] • https://git-scm.com/downloads • Create and activate virtual env • https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments • Install Sphinx from pypi • pip install -U sphinx • https://www.sphinx-doc.org/en/master/usage/installation.html#installation-from- pypi • Install RTD Theme • pip install sphinx_rtd_theme • https://pypi.org/project/sphinx-rtd-theme/ • Theme config: https://sphinx-rtd-theme.readthedocs.io/en/stable/configuring.html
  • 12. Resources • Setup documentation source structure • sphinx-quickstart • https://www.sphinx-doc.org/en/master/usage/quickstart.html#setting-up- the-documentation-sources • Build Configuration file [conf.py] • The file is generated with documentation source structure • Options in file have include description • https://www.sphinx-doc.org/en/master/usage/configuration.html • Building [converting RST to HTML] • sphinx-build sourcedir builddir • https://www.sphinx-doc.org/en/master/usage/quickstart.html#running-the- build