Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(lib): rst syntax and docs
  • Loading branch information
jeertmans committed Aug 29, 2023
commit 8ece318c69f7a07b89fe4fa46be249855faa2964
16 changes: 3 additions & 13 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,8 @@ jobs:
id: cache-media-restore
uses: actions/cache/restore@v3
with:
path: media
key: ${{ runner.os }}-media
- name: Build animations
run: |
poetry run manim example.py ConvertExample BasicExample ThreeDExample
- name: Convert animations to HTML slides
run: |
poetry run manim-slides convert -v DEBUG ConvertExample docs/source/_static/slides.html -ccontrols=true
poetry run manim-slides convert -v DEBUG BasicExample docs/source/_static/basic_example.html -ccontrols=true
poetry run manim-slides convert -v DEBUG ThreeDExample docs/source/_static/three_d_example.html -ccontrols=true
- name: Show docs/source/_static/ dir content (video only)
run: tree -L 3 docs/source/_static/ -P '*.mp4'
path: docs/media
key: ${{ runner.os }}-docs-media
- name: Clear cache
run: |
gh extension install actions/gh-actions-cache
Expand All @@ -78,7 +68,7 @@ jobs:
id: cache-media-save
uses: actions/cache/save@v3
with:
path: media
path: docs/media
key: ${{ steps.cache-media-restore.outputs.cache-primary-key }}
- name: Build docs
run: cd docs && poetry run make html
Expand Down
12 changes: 8 additions & 4 deletions docs/source/reference/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ Basic example from quickstart.

Example using 3D camera. As Manim and ManimGL handle 3D differently, definitions are slightly different.

<div style="position:relative;padding-bottom:56.25%;"> <iframe style="width:100%;height:100%;position:absolute;left:0px;top:0px;" frameborder="0" width="100%" height="100%" allowfullscreen allow="autoplay" src="../_static/three_d_example.html"></iframe></div>

### With Manim

```{eval-rst}
.. manim-slides: ../../../example.py:ThreeDExample
:hide_source:
:quality: high

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
Two consecutive dots (DOUBLE_PUNCTUATION)
Suggestions: .,
URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-periods
Rule: https://community.languagetool.org/rule/show/DOUBLE_PUNCTUATION?lang=en-US
Category: PUNCTUATION

.. literalinclude:: ../../../example.py
:language: python
:linenos:
Expand Down Expand Up @@ -122,9 +124,11 @@ directly write the `construct` method in the body of `MovingCameraSlide`.

A more advanced example is `ConvertExample`, which is used as demo slide and tutorial.

<div style="position:relative;padding-bottom:56.25%;"> <iframe style="width:100%;height:100%;position:absolute;left:0px;top:0px;" frameborder="0" width="100%" height="100%" allowfullscreen allow="autoplay" src="../_static/slides.html"></iframe></div>

```{eval-rst}
.. manim-slides: ../../../example.py:ConvertExample
:hide_source:
:quality: high

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
Two consecutive dots (DOUBLE_PUNCTUATION)
Suggestions: .,
URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-periods
Rule: https://community.languagetool.org/rule/show/DOUBLE_PUNCTUATION?lang=en-US
Category: PUNCTUATION

.. literalinclude:: ../../../example.py
:language: python
:linenos:
Expand Down
10 changes: 5 additions & 5 deletions manim_slides/docs/manim_slides_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
This directive requires three additional dependencies:
``manim``, ``docutils`` and ``jinja2``. The last two are usually bundled
with Sphinx.
You can install them manually, or with the extra keyword::
You can install them manually, or with the extra keyword:

pip install manim-slides[sphinx-directive]

Expand All @@ -30,7 +30,7 @@
Usage
-----

First, you must include the directive in the Sphinx configuration file::
First, you must include the directive in the Sphinx configuration file:

.. code-block:: python
:caption: Sphinx configuration file (usually :code:`docs/source/conf.py`).
Expand Down Expand Up @@ -79,11 +79,10 @@ def construct(self):
.. warning::

The code will be executed with the current working directory
being the same as the one ``sphinx-build` was called in. This being said,
being the same as the one containing the source file. This being said,
you should probably not include examples that rely on external files, since
relative paths risk to be broken.


Options
-------

Expand All @@ -93,7 +92,7 @@ def construct(self):
:<option name>: <value>

The following configuration options are supported by the
directive:
directive::

hide_source
If this flag is present without argument,
Expand Down Expand Up @@ -315,6 +314,7 @@ def split_file_cls(arg: str) -> Tuple[Path, str]:

try:
with tempconfig(example_config):
print(f"Rendering {clsname}...")
run_time = timeit(lambda: exec("\n".join(code), globals()), number=1)
video_dir = config.get_dir("video_dir")
except Exception as e:
Expand Down