简体   繁体   中英

How to preview and print in PDF a markdown file with a file-specific CSS stylesheet in VS Code?

Here is my use case:

I want to create a markdown document (my CV for instance) and create a style for it using a CSS file. Then I want to print the PDF of my file.

I have installed the Markdown PDF extension in VS Code and it does its job.

To have the extension and the preview to properly render the styling, I changed the settings in vscode setting.json for both extensions to use my CSS file and it works.

For the preview:

{
  "markdown.styles": ["my-styles.css"]
}

For the PDF export:

{
  "markdown-pdf.styles": ["~/Documents/Styles/my-styles.css"]
}

However, this stylesheet is applied to all my markdown files and what I would like is to embed the CSS file for this specific file. I want to have a CV style for my CVs, a report style for reports, etc.

Is this feasible?

Using workspace specific settings solves my issue.

It does not allow to use one CSS per markdown file, but it's good enough: I can put all my CVs in one folder with the CV CSS in the workspace settings and my reports in another workspace with another CSS stylesheet

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM