https://github.com/casualcodersprojects/manim-code-blocks
https://github.com/casualcodersprojects/manim-code-blocks
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/casualcodersprojects/manim-code-blocks
- Owner: CasualCodersProjects
- License: mit
- Created: 2024-02-14T15:31:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-20T23:53:07.000Z (over 2 years ago)
- Last Synced: 2024-09-25T16:57:59.714Z (almost 2 years ago)
- Language: Python
- Homepage: https://pypi.org/project/manim-code-blocks-redux
- Size: 7.81 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Manim Code Blocks Redux
`manim-code-blocks-redux` is a library for [Manim](https://github.com/ManimCommunity/manim) that allows animating blocks of code in Manim videos and scenes.
## Example Usage
```python
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_code](https://github.com/CasualCodersProjects/tokenize_all_code) 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_code](https://github.com/CasualCodersProjects/tokenize_all_code) 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](https://github.com/CasualCodersProjects/manim-code-blocks/issues).
### Lack of Themes
Currently the only theme supported out of the box is the [One Dark Pro](https://github.com/Binaryify/OneDark-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.