Animate highlighted blocks of code in Manim
Project description
Manim-Code-Blocks
Manim-Code-Blocks
is a library for Manim that allows animating blocks of code in Manim videos and scenes.
Example Usage
from manim import *
from manim_code_blocks import *
class Main(Scene):
def construct(self):
java = CodeBlock(
"""
public class Main {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
""",
language = Java
)
self.play(*java.create(run_time = 3))
Outputs:
Problems & Limitations
Limited Language Support
Currently only the following languages are supported for syntax highlighting:
- C
- C#
- C++
- Java
- JavaScript
- Lua
- Go
- Python
- Rust
- TypeScript
To add language support, submit a pull request to to the Tokenize-All module.
Unintelligent Highlighting
Manim-Code-Block
uses syntax highlighting, not semantic highlighting. The source code is only tokenized, not parsed, and as such accurate highlighting can be impossible for certain circumstances. Syntax highlighting is provided by the Tokenize-All module, which lacks thorough language support. Additionally many languages have not been thoroughly tested enough for accurate highlighting. If you find an issue in your syntax highlighting, please report it to the issues thread.
Lack of Themes
Currently the only theme supported out of the box is the One Dark Pro theme from Atom and used in Visual Studio Code. Adding a custom theme is possible (and simple), however currently this is the only theme supported out of the box.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for manim_code_blocks-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8415ec068981220205ae425dbf56ceb932f9fd56f5f06d4850aed6824d016742 |
|
MD5 | 34c8374eab27f79d0de98fb88f102292 |
|
BLAKE2b-256 | 9bbcb76eaf72d1f41f6bd58b386fecdd473fc6a99c07f0b21e5060878025a68f |