Skip to content

Use language parameter to format Code even when passing code_file#4706

Merged
chopan050 merged 3 commits into
ManimCommunity:mainfrom
GniLudio:fix_code_from_file_language_override
Jun 10, 2026
Merged

Use language parameter to format Code even when passing code_file#4706
chopan050 merged 3 commits into
ManimCommunity:mainfrom
GniLudio:fix_code_from_file_language_override

Conversation

@GniLudio

@GniLudio GniLudio commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Overview: What does this pull request change?

Allows the usage of the language parameter in combination with the code_fileparameterwhen creating aCode` object.

from manim import *

class TestScene(Scene):
    def construct(self):
        self.add(
            Code(
                code_file="main.py",
                language="text", # was ignored before
            )
        )

Motivation and Explanation: Why and how do your changes improve the library?

Further Information and Comments

  • Changes nothing for when the language parameter is omitted.
  • Especially useful when pygments can't find a lexer.

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@chopan050 chopan050 changed the title Fix Use language parameter to format Code even when passing code_file Jun 10, 2026

@chopan050 chopan050 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@chopan050 chopan050 enabled auto-merge (squash) June 10, 2026 21:37
@chopan050 chopan050 merged commit 561de9d into ManimCommunity:main Jun 10, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants