ManimCommunity / ManimCommunity/manim
Manim directive duplicates code
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## 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:
```rst
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:

## Expected behavior
The second code snippet should not be there. A workaround is removing the relative HTML code, that is:
```HTML
class MyScene(Scene):
def construct(self):
circle = Circle()
self.play(Create(circle))
self.wait()
```
This is the result:

## 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the provided .rst example and inspect the manim_directive output during Sphinx rendering. Compare the generated HTML with the workaround, and consider the issue done when the rendered scene contains the video without a duplicated code snippet.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100