Allow for custom css sheet overrides for reports#1573
Conversation
|
@ewels any chance I could get you to take a look at this? Happy to revise as you see helpful. |
ewels
left a comment
There was a problem hiding this comment.
Yeah, sorry - I've been on paternity leave and now working 50% so I'm very behind on MultiQC maintenance work.
Love the idea of this PR though, have done a quick read on my phone with one or two minor comments but happy to merge once resolved 👍🏻
Thanks for this!
| {{ include_file('assets/css/jquery.toast.css') }} | ||
| </style> | ||
| {% for css_href in config.custom_css_files %} | ||
| <style type="text/css">{{ include_file(css_href, None) }}</style> |
There was a problem hiding this comment.
I forget, what is the second argument for? Is it needed?
There was a problem hiding this comment.
def include_file(name, fdir=tmp_dir, b64=False):
try:
if fdir is None:
fdir = ""
if b64:
with io.open(os.path.join(fdir, name), "rb") as f:
return base64.b64encode(f.read()).decode("utf-8")
else:
with io.open(os.path.join(fdir, name), "r", encoding="utf-8") as f:
return f.read()
It's the root dir, looks like. I suspect we can actually omit it. I just copy/pasta'd from right above it.
| config.exclude_modules = exclude | ||
| if profile_runtime: | ||
| config.profile_runtime = True | ||
| if custom_css_files is not None and len(custom_css_files) > 0: |
There was a problem hiding this comment.
I have a feeling that if a click argument accepts multiple, it returns an empty list of not specified. So you can probably ditch this line if that's true.
But worth checking as this is off the top of my head 😅
| @click.option("--profile-runtime", is_flag=True, help="Add analysis of how long MultiQC takes to run to the report") | ||
| @click.option("--no-ansi", is_flag=True, help="Disable coloured log output") | ||
| @click.option( | ||
| "--custom-css-files", |
There was a problem hiding this comment.
I don't think that you need this twice..
There was a problem hiding this comment.
You're probably right. Above:
@click.option(
"--cl-config", "--cl_config", type=str, multiple=True, help="Specify MultiQC config YAML on the command line"
)
But lemme try taking it out :)
There was a problem hiding this comment.
Yeah, past-me probably didn't know better. Only needed when doing short form + long form if I remember correctly.
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
|
Congrats on the pat leave :) I implemented your suggestions. Thanks for working through. If you have any additional cycles, I cut another 3 PRs. These 2 should be a slam dunk: And this one's a tad hairier: |
|
Nice, thanks! Ready to merge apart from the failing CI tests that are due to changing CSPs. I never completely wrapped my head around this stuff. Are you ok to look into it and try to get the tests passing? |
|
Ah crap, looks like that test is failing on all PRs. Ok may need some thought, I'd be nice to have some green ticks before merging if possible.. |
|
Ah you're a hero! No need to rebase, can just rerun actions. |
|
Seems like actions run at the current sha, not rebasing on master. Should I just rebase and push? |
|
Ok fab, thanks! |
|
It's none of my business, but how come an engineer from Stripe is running MultiQC? Do you have some bioinformatics side project or are you using MultiQC for something totally different? |
Nothing employer/work related - just nerding out on weekends, trying to learn :P |
|
Awesome. Happy to have you here 😀 |
Adds the ability to specify CSS overrides. I know it's possible to add css to custom modules, but we'd like to do it for the simple/default reports, without specifying entirely new modules.
For example, I'd like to add css rules for the css
printmedia query. I will merge these with upstream. But for the short term, it's useful to just specify a bunch of overrides, and then get them merged. This will allow for e.g. beautiful print exports of multiqc reports (currently e.g. background colours don't show up). Let me know what you think!CHANGELOG.mdhas been updatedI tried this out with a few configurations:
You can see the logo and sidebar are huge here.
Then I built/ran with cli flags:
Finally, I removed the flags and config file:

We're back to normal looking reports.