Skip to main content

Animate highlighted blocks of code in Manim

Project description

Manim Code Blocks Redux

manim-code-blocks-redux 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_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 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manim_code_blocks_redux-1.0.14.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

manim_code_blocks_redux-1.0.14-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file manim_code_blocks_redux-1.0.14.tar.gz.

File metadata

File hashes

Hashes for manim_code_blocks_redux-1.0.14.tar.gz
Algorithm Hash digest
SHA256 7bafc10e7cf41107ca0ceb397b02b6d518325224dc96df9a2c9fc713f0799618
MD5 843d9817fec16d53b701f638daf55114
BLAKE2b-256 f9cab224908d021fd8ba754fdfb7257d9b433cc22d2c3230a4bd37d258acb3e5

See more details on using hashes here.

File details

Details for the file manim_code_blocks_redux-1.0.14-py3-none-any.whl.

File metadata

File hashes

Hashes for manim_code_blocks_redux-1.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 c2fe1d322d6ae0926de850a82b77a6205d5d2730e35aa408d3709a71c7e0c4b2
MD5 27bbfc5ae50aa09af55da4a0680a5003
BLAKE2b-256 f98277b1a04d1640edbca75e1e39b48c58dccdc2b506f4129f7caa7a7f6399f8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page