Skip to main content

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


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-1.0.11.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

manim_code_blocks-1.0.11-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file manim_code_blocks-1.0.11.tar.gz.

File metadata

  • Download URL: manim_code_blocks-1.0.11.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for manim_code_blocks-1.0.11.tar.gz
Algorithm Hash digest
SHA256 07269754c34425a8685595fccd50500894f7827d1b6e80ad445ec6089d25575b
MD5 f3d0cf22e09dd977e2df18320b493a58
BLAKE2b-256 2952c67b36f80e5bb5cae599f86288cd3123c9a2854a2b71c4099af91ca9f5eb

See more details on using hashes here.

File details

Details for the file manim_code_blocks-1.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for manim_code_blocks-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 cb5471bb8a4cb03b1e3f831c6f844b256edc45dc7ce13cb1cdaa16dfa96a7d95
MD5 6821cb1ed4d8ab60380f5413e9f8dfe6
BLAKE2b-256 10ba7e9a78f42e8113a438b50e0c13b52f9f968b62b48b61889d34c30df527fa

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