jupyter-book / jupyterlab-myst

Use MyST Markdown directly in Jupyter Lab
https://jupyter-book.github.io/jupyterlab-myst/
BSD 3-Clause "New" or "Revised" License
141 stars 16 forks source link

code-blocks always have black text #167

Closed jans-code closed 1 year ago

jans-code commented 1 year ago

No matter what theme i choose and no matter how i define the code-blocks in markdown, they are always rendered with black text.

This is also true when defining a language, for which syntax highlighting works in the default jupyter markdown view.

But with jupyterlab_myst I always get black text, i was able to fix the css in my dark theme, so the code was at least readable.

welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

rowanc1 commented 1 year ago

Thanks for the bug report @jans-code. @agoose77 most of the dark-mode is triggered off of CSS, except for the code, which does need to load a new style using JS.

Where we define the styles to look to Jupyter: https://github.com/executablebooks/jupyterlab-myst/blob/dedbb1d785a02612da05fa798c7091c25b607a59/tailwind.config.js#L4

The place where we need to also look to that style and change it: https://github.com/executablebooks/jupyterlab-myst/blob/dedbb1d785a02612da05fa798c7091c25b607a59/src/widget.tsx#L153

Something like looking for the theme on the body should work:

document.body.dataset.jpThemeLight === 'false'

I will put together a PR.

rowanc1 commented 1 year ago

Nice, that works well! It does require a page refresh or to re-execute the cell but I think that is ok for now.

image

rowanc1 commented 1 year ago

This has been fixed and merged, we will get a patch release out soon!

agoose77 commented 1 year ago

The place where we need to also look to that style and change it:

Oops. Been staring at that code so much of late that I forgot to actually read it!

rowanc1 commented 1 year ago

This is released in v2.0.1!