Skip to content

WhitePaper233/manim-code-blocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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, read the new language support guide and submit a pull request.

Unintelligent Highlighting

The syntax highlighting provided by Manim-Code-Blocks is largely trival and can in many cases be inaccurate. The source code is only tokenized, not parsed, and as such accurate token type identification can be impossible for certain circumstances. Syntax highlighting is provided by the Tokenize-All module, which is also largely trival and lacks thorough language support. Additionally many languages have not been thoroughly tested enough for accurate coloring. If you find an issue in your syntax highlighting, please report it to the issues thread.

About

Animate code snippets in Manim.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages