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

When generating html from md with --embed-resources --standalone, CSS styles from --css are not included correctly when loading from remote url, works fine with local file #10261

Closed
Rudokhvist opened this issue Oct 5, 2024 · 5 comments
Labels

Comments

@Rudokhvist
Copy link

Explain the problem.
I'm trying to generate --standalone --embed-resources .html from .md with custom style specified with --css. It works fine when I use css from a file on local filesystem, but don't work when I specify a https url to the very same file.

Steps to reproduce

  • Download archive with sample files:
    MRE.zip
  • make shell script example.sh executable and run it. It will generate two html files, with css loaded from remote url (result1.html) and with css from local file (downloaded fro the same remote url) (result2.html).
  • You can now compare those files, and see that result1.html don't show any of the embedded styles.

Pandoc version?
I'm using latest stable version of pandoc, 3.4, on Windows 10. I also tried latest nightly build with same result.

Misc
This issue may be connected to #7635, #7367 and #3423, but only affects remote urls and results are more dramatic, causing styles to not affect resulting document.

@Rudokhvist Rudokhvist added the bug label Oct 5, 2024
@jgm
Copy link
Owner

jgm commented Oct 5, 2024

So with the remote --css, we get a <link href="data:text/plain...> with the contents of the CSS file encoded, while with local --css, we get a proper <style> tag.

@jgm
Copy link
Owner

jgm commented Oct 5, 2024

Ah I see, it's because it is being served with a text/plain mime type, not text/css.

@jgm
Copy link
Owner

jgm commented Oct 5, 2024

I will add an alternative check for rel="stylesheet".

@jgm jgm closed this as completed in 70b2c5f Oct 5, 2024
@Rudokhvist
Copy link
Author

Thank you for the fast fix! I will check it when Nightly will build.

@Rudokhvist
Copy link
Author

Tested with artifact from https://github.com/jgm/pandoc/actions/runs/11195907421, works like a charm, thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants