mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-06-06 11:28:55 +08:00
chore(docs): improve directive's documentation
This commit is contained in:
0
manim_slides/docs/__init__.py
Normal file
0
manim_slides/docs/__init__.py
Normal file
@ -16,12 +16,28 @@ A directive for including Manim slides in a Sphinx document
|
|||||||
When rendering the HTML documentation, the ``.. manim-slides::``
|
When rendering the HTML documentation, the ``.. manim-slides::``
|
||||||
directive implemented here allows to include rendered videos.
|
directive implemented here allows to include rendered videos.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
|
||||||
|
First, you must include the directive in the Sphinx configuration file:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
:caption: Sphinx configuration file (usually :code:`docs/source/conf.py`).
|
||||||
|
:emphasize-lines: 3
|
||||||
|
|
||||||
|
extensions = [
|
||||||
|
# ...
|
||||||
|
"manim_slides.docs.manim_slides_directive",
|
||||||
|
]
|
||||||
|
|
||||||
Its basic usage that allows processing **inline content**
|
Its basic usage that allows processing **inline content**
|
||||||
looks as follows::
|
looks as follows::
|
||||||
|
|
||||||
.. manim-slides:: MySlide
|
.. manim-slides:: MySlide
|
||||||
|
from manim import *
|
||||||
|
from manim_slides import Slide
|
||||||
|
|
||||||
class MySlide(Scene):
|
class MySlide(Slide):
|
||||||
def construct(self):
|
def construct(self):
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -34,15 +50,15 @@ render scenes that are defined within doctests, for example::
|
|||||||
.. manim-slides:: DirectiveDoctestExample
|
.. manim-slides:: DirectiveDoctestExample
|
||||||
:ref_classes: Dot
|
:ref_classes: Dot
|
||||||
|
|
||||||
>>> from manim import Create, Dot, RED, Scene
|
>>> from manim import Create, Dot, RED
|
||||||
|
>>> from manim_slides import Slide
|
||||||
>>> dot = Dot(color=RED)
|
>>> dot = Dot(color=RED)
|
||||||
>>> dot.color
|
>>> dot.color
|
||||||
<Color #fc6255>
|
<Color #fc6255>
|
||||||
>>> class DirectiveDoctestExample(Scene):
|
>>> class DirectiveDoctestExample(Slide):
|
||||||
... def construct(self):
|
... def construct(self):
|
||||||
... self.play(Create(dot))
|
... self.play(Create(dot))
|
||||||
|
|
||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
|
|
||||||
@ -86,7 +102,7 @@ from timeit import timeit
|
|||||||
|
|
||||||
import jinja2
|
import jinja2
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.parsers.rst import Directive, directives # type: ignore
|
from docutils.parsers.rst import Directive, directives
|
||||||
from docutils.statemachine import StringList
|
from docutils.statemachine import StringList
|
||||||
from manim import QUALITIES
|
from manim import QUALITIES
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user