Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code blocks in Markdown widget do not respect the "theme" setting. #3997

Closed
ggozad opened this issue Jan 10, 2024 · 2 comments · Fixed by #4001
Closed

Code blocks in Markdown widget do not respect the "theme" setting. #3997

ggozad opened this issue Jan 10, 2024 · 2 comments · Fixed by #4001

Comments

@ggozad
Copy link
Contributor

ggozad commented Jan 10, 2024

When switching theme from "dark" to "light" by means of setting the app.dark attribute, code blocks within the Markdown do not adapt accordingly.

Screenshot 2024-01-10 at 11 14 18
Screenshot 2024-01-10 at 11 14 08

I think the culprit is MarkdownFence. Specifically in compose() ,

    def compose(self) -> ComposeResult:
        from rich.syntax import Syntax

        yield Static(
            Syntax(
                self.code,
                lexer=self.lexer,
                word_wrap=False,
                indent_guides=True,
                padding=(1, 2),
                theme="material",
            ),
            expand=True,
            shrink=False,
        )

Syntax is used with a hardcoded "material" theme.

Copy link

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

Copy link

github-actions bot commented Feb 8, 2024

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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 a pull request may close this issue.

1 participant