question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade to 7.0.0 breaks CSS?

See original GitHub issue

Has anyone else seen this? I upgraded to the new markdown-pdf 7.0.0 in order to get the new links-in-PDFs behavior, only to find that now my CSS is broken. As in, either markdown-pdf or PhantomJS (can’t tell which) just isn’t looking at my CSS file at all anymore. The output is exactly the same as if I take the cssPath value out of my markdown-pdf options entirely.

I have changed literally nothing in my app. All I did was npm update markdown-pdf, and wham, CSS is busted. I’ve double-checked that the CSS file really is still there, et cetera. Here’s how I’m invoking markdown-PDF:

fileList = buildFileList() // collect file information from src/documents/*.md
var options = {
    preProcessMd: preProcessMd,
    cssPath: "src/static/styles/default.css",
    remarkable: {
        html: true
    }
}

markdownpdf(options)
    .concat.from(
        fileList.map(function(val){ return val.path } )
    )
    .to(getOutputFilename(fileList[0].title), function () {
  console.log("Done.")
})

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

13reactions
animeoakescommented, Mar 10, 2016

Adding cssPath = 'file:///' + cssPath to the page.evaluate block of render.js fixes the problem for me.

// Add custom CSS to the page
page.evaluate(function (cssPaths) {
  var head = document.querySelector('head')
  cssPaths.forEach(function (cssPath) {
    cssPath = 'file:///' + cssPath
    var css = document.createElement('link')
    css.rel = 'stylesheet'
    css.href = cssPath

    head.appendChild(css)
  })
}, [args.cssPath, args.highlightCssPath])
3reactions
jasonb-vbtcommented, Feb 10, 2016

FYI, this is no longer a blocking issue for me. I switched from markdown-pdf to marked for md-to-html conversion plus wkhtmltopdf for html to pdf. Works great.

I still think the underlying issue for me was with phantom, not with markdown-pdf itself. What finally made me give up on this particular toolchain was converting all my .md files to one monolithic HTML, with a <style>block for the css, verifying that the HTML looks correct in the browser, manually invoking phantomjs on it as per your gist, and having phantom just plain hang on me. So F-it, I’m using a different tool. If you guys get tired of fighting with phantom, maybe give wkhtmltopdf a look?

Thanks for all your efforts in helping me narrow this down. If you want to close this issue as no-repro, I won’t object.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js Sass version 7.0.0 is incompatible with ^4.0.0 || ^5.0.0
It's the sass-loader issue and that's the library you need to upgrade since older versions are not compatible with the newer node-sass ....
Read more >
Upgrading Your Theme from Liferay Portal 6.1 to 7.0
This tutorial guides you through the process of upgrading your 6.1 theme to run on Liferay DXP 7.0. For a more in depth...
Read more >
Migration angular 11 -> 12 causing Unknown error ... - GitHub
Hi, Migrated from angular 11 to 12 recently. Fixed few of the broken css files. But then got caught with this same error....
Read more >
Preparing for Confluence 7.0 - Atlassian Documentation
It's a platform release, so will contain breaking changes. ... Confluence 7.0 will include a major upgrade of AUI (the Atlassian User Interface)...
Read more >
Upgrading Guide - Keycloak
RESTEasy Version Update; H2 Version Update; Breaking changes in the ... diff KEYCLOAK_HOME_OLD/themes/keycloak/login/resources/css/login.css ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found