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

base64 encoding of CSS file not working in pandoc 1.14 #2224

Closed
jjallaire opened this issue Jun 11, 2015 · 4 comments
Closed

base64 encoding of CSS file not working in pandoc 1.14 #2224

jjallaire opened this issue Jun 11, 2015 · 4 comments
Labels

Comments

@jjallaire
Copy link

I've noticed that when pandoc 1.14 attempts to base64 encode the bootstrap.min.css CSS file it doesn't work (whereas it did in pandoc 1.13). From a simple example (link to code of which is below) here is what I observe:

  • In pandoc 1.13.2 the CSS file is fully inlined as base64 content and all boostrap styles are applied to the content (i.e. the background of the code blocks is shaded). The size of this file is 385.5 KB.
  • In pandoc 1.14.1 it looks like only part of the CSS file is inlined (the size of the generated HTML file is 78.5 KB). Not surprisingly the bootstrap styles are not applied to the code blocks (there is no background shading).

Here's the code for the minimal reproducible example: https://github.com/jjallaire/pandoc-1.14-base64

@jgm
Copy link
Owner

jgm commented Jun 12, 2015

Probably introduced in 1b44acf, when we replaced crufty CSS parsing heuristics with a real css parser (text-css).

Needs further investigation.

@jgm
Copy link
Owner

jgm commented Jun 12, 2015

Sure enough, the problem seems to lie with css-text.
If you do parseNestedBlocks on the bootstrap.min.css file, and then renderNestedBlocks on the result, you get a much shorter text.
Opened issue yesodweb/css-text#6

@jjallaire
Copy link
Author

I discovered another issue with the new CSS handling -- it fails when attempting to embed a font file that's referenced within the CSS. After modifying the original example to include a CSS file (flatly.min.css) that contains references to embedded TrueType fonts, I observe different results depending on whether I use pandoc 1.13.2 or pandoc 1.14.1:

  • In pandoc 1.13.2 the conversion succeeds.

  • In pandoc 1.14.0.1 the conversion fails with this error:

    pandoc: Could not fetch bootstrap/css/fonts/Lato.ttf) format('truetype
    bootstrap/css/fonts/Lato.ttf) format('truetype: openBinaryFile: does not exist
    (No such file or directory)
    

I've added this case to the repo that contains the reproducible example code: https://github.com/jjallaire/pandoc-1.14-base64

@Thell
Copy link

Thell commented Jun 20, 2015

Closed rstudio/rmarkdown #454 as a dupe of this issue, and commenting here to subscribe.

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

3 participants