Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manim directive duplicates code #3994

Open
F4bbi opened this issue Nov 2, 2024 · 1 comment
Open

Manim directive duplicates code #3994

F4bbi opened this issue Nov 2, 2024 · 1 comment

Comments

@F4bbi
Copy link

F4bbi commented Nov 2, 2024

Description of bug / unexpected behavior

When using manim_directive for including Manim videos in a Sphinx document, the code snippet is duplicated in the rendered output.
For example, given this .rst file:

My Plugin Documentation
=======================

Test
----

TODO

.. manim:: MyScene

    class MyScene(Scene):
        def construct(self):
            circle = Circle()
            self.play(Create(circle))
            self.wait()

This is the result:

image

Expected behavior

The second code snippet should not be there. A workaround is removing the relative HTML code, that is:

<pre data-manim-binder data-manim-classname="MyScene">
class MyScene(Scene):
    def construct(self):
        circle = Circle()
        self.play(Create(circle))
        self.wait()

</pre>

This is the result:

image

How to reproduce the issue

  1. Use manim_directive with a simple scene, as shown in the example below.
  2. Render the scene.

System specifications

System Details
  • OS: macOS 12.7.5 (Monterey)
  • RAM: 8GB
  • Python version (python/py/python3 --version): 3.12.6
@behackl
Copy link
Member

behackl commented Nov 2, 2024

I am not sure I would qualify this as a bug -- but you are right, we are using the directive to generate both the default output in the admonition, as well as an extra block for the interactive embed. We need to keep this block for the documentation, but perhaps there should be some sort of configuration option that toggles whether these additional blocks are written.

PRs are welcome!

@JasonGrace2282 JasonGrace2282 changed the title [BUG] manim_directive duplicates code Manim directive duplicates code Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants