Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

higlight_config argument to dcc.Markdown has by default no effect in dcc>=1.13 #968

Description

@anders-kiaer

As stated in the dcc.Markdown documentation (https://dash.plotly.com/dash-core-components/markdown) you can use

highlight_config (dict; optional): Config options for syntax highlighting. highlight_config is a dict with keys:
theme (a value equal to: 'dark', 'light'; optional): Color scheme; default 'light'.

After dash-core-components==1.13, the settings of highlight_config has no effect. This 🪲 appears to be introduced in #871 where one css file (defining both light and dark theme) was changed with another css file defining only a light theme variation.

As stated on another page (https://dash.plotly.com/external-resources#md-syntax-highlight) in the docs, you can override default highlight.js style if you want other than e.g. the current GitHub style, however, I don't think it is intended from dcc point of view that the default dcc provided style needs to be overridden in order for higlight_config to have effect (if so it should be stated close to the highlight_config explanation probably in the documentation).

Test case:

import dash
import dash_core_components as dcc

app = dash.Dash()

app.layout = dcc.Markdown(
    """```
def some_function():
    return 42
```""",
    highlight_config={"theme": "dark"},
)

if __name__ == "__main__":
    app.run_server()

gives the same result as when {"theme": "light"}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions