-
Notifications
You must be signed in to change notification settings - Fork 30
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
difficult to override styles #42
Comments
Unfortunately, this gets really tricky. With the way Wagtail blocks work, I can only inject code into the rendered block section. That's why the CSS is injected here:
Can you override with |
Thanks for responding so quickly! Here's what I've implemented locally: in my template header, before I include project-specific styles, I added this: {% for block in page.body %}
{% if block.block_type == "code" %}
{% load_prism_css %}
{% endif %}
{% endfor %} And then I overrode the This might be loading prism multiple times for multiple code blocks on the same page, I haven't checked... I do still actually have to use So it's feasible, but would require an additional setup step for people using your library. Wondering if this could be optional (non-default) behavior configured by a django setting? I'm willing to submit a PR for that if you're interested. If you think there's a simpler solution for this, please suggest! |
I think what we might be able to do is modify the settings. Right now, we set the default theme to We may be able to make it so that if you set |
@FlipperPA that's a nice thought - then you can just set this config and load the theme yourself if you want it handled elsewhere. Seems like an elegant solution to me. |
I'll think on it for a day or two (I'm going to be traveling) but will try to get this in the next release. Cheers! |
Thanks for this useful library!
I'm having trouble overriding styles - I think because your block includes the prism css with the content, so it takes precedence over my site-wide styles that are included in the page header.
Wondering if instead the prism styles could be loaded in the header if the page includes a code block, so that local styles could be given precedence. Could maybe be done as a new template tag, or a revised version of the existing
load_prism_css
tag.The text was updated successfully, but these errors were encountered: