Skip to content

Manim directive duplicates code #3994

Open
@F4bbi

Description

@F4bbi

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

Activity

behackl

behackl commented on Nov 2, 2024

@behackl
Member

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!

changed the title [-][BUG] manim_directive duplicates code[/-] [+]Manim directive duplicates code[/+] on Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @behackl@F4bbi

        Issue actions

          Manim directive duplicates code · Issue #3994 · ManimCommunity/manim