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

Fix: Specifying custom style sheets with a relative path does not work #170

Merged
merged 1 commit into from
Feb 16, 2020

Conversation

hirschmann
Copy link
Contributor

@hirschmann hirschmann commented Dec 18, 2019

Setting relative paths in markdown-pdf.styles currently (VS Code 1.41.0, Markdown PDF 1.4.1) does not work because the path will always be converted to a absolute path.
For example styles/custom.css will become files:///styles/custom.css
This makes Markdown PDF fall back to the VS Code default styles.

The reason is, that hrefUri.scheme === 'file' is not only true for absolute file paths, but also for relative paths.

This PR fixes this issue.

@JamesAlias
Copy link

As dirty workaround while we wait for this PR to be merged and released:
You can include the style file like this:

<!-- styles.md -->
<style>
  ... content of your style file
</style>

<!-- in your markdownThatWillBeRenderedToPDF.md -->
:[styles](<path/to/styles.md>)
... content to be rendered to PDF

The styles will then be included as style tag in the transient html file. (md -> html -> pdf).

@yzane yzane added this to the 1.4.2 milestone Feb 11, 2020
Copy link

@teterkin teterkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JS is correct.

@yzane yzane merged commit 3fb38e9 into yzane:master Feb 16, 2020
@yzane
Copy link
Owner

yzane commented Feb 16, 2020

Thanks for your PR!

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

Successfully merging this pull request may close these issues.

None yet

4 participants