summaryrefslogtreecommitdiff
path: root/sphinx/application.py
diff options
context:
space:
mode:
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 4a3db25e7..59ac04b20 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -623,14 +623,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
@@ -643,7 +643,8 @@ class Sphinx:
def run(self):
...
- add_directive('literalinclude', LiteralIncludeDirective)
+ def setup(app):
+ add_directive('my-directive', MyDirective)
If *override* is True, the given *cls* is forcedly installed even if
a directive named as *name* is already installed.