Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-10-04 08:22:02 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-10-04 08:22:02 +0300
commit7b395f6b25ce1fa78480508a1de4be2510fd2189 (patch)
tree94874fe05433b3558d23b15172337058ad3ede91 /sphinx/application.py
parentd8cb7aa4f668f1bf92458372568e1be110501eb8 (diff)
docs: Fix an example for add_directive()
Diffstat (limited to 'sphinx/application.py')
-rw-r--r--sphinx/application.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/sphinx/application.py b/sphinx/application.py
index f91027bf7..d06986764 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -611,14 +611,14 @@ class Sphinx:
details, see `the Docutils docs
<http://docutils.sourceforge.net/docs/howto/rst-directives.html>`_ .
- For example, the (already existing) :rst:dir:`literalinclude` directive
- would be added like this:
+ For example, a custom directive named ``my-directive`` would be added
+ like this:
.. code-block:: python
from docutils.parsers.rst import Directive, directives
- class LiteralIncludeDirective(Directive):
+ class MyDirective(Directive):
has_content = True
required_arguments = 1
optional_arguments = 0
@@ -631,7 +631,8 @@ class Sphinx:
def run(self):
...
- add_directive('literalinclude', LiteralIncludeDirective)
+ def setup(app):
+ add_directive('my-directive', MyDirective)
.. versionchanged:: 0.6
Docutils 0.5-style directive classes are now supported.