yzane / vscode-markdown-pdf

Markdown converter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=yzane.markdown-pdf
Other
1.01k stars 206 forks source link

Feature request: per document settings #173

Open regisin opened 4 years ago

regisin commented 4 years ago

I'm using markdown and this plugin for work and it works great. One thing that would be useful, although not urgent at all, would be to edit the settings on a per file basis. In my specific case I have some documents that need to be output in a single column (i.e. all the content will be on the left half of the page, while the right is blank). Since not all files I create need this specific setting, I find myself editing the "markdown-pdf.margin.right" property very often.

thiloplanz commented 4 years ago

I imagine this could take the form of a file x.markdown-pdf.json placed next to its x.md and it would provide an additional override using the same format as the Workspace configuration JSON.

regisin commented 4 years ago

That didn't work. But my workaround is to just subdivide those files into sub folders and use workspace settings instead.

I know md files have that front-matter with some settings at the top sometimes, for ex.:

---
title: something-that-wont-be-printed
---
# Header
Text

Could that be used somehow?

Morikko commented 2 years ago

Just sharing a workaround applicable for some type of settings, by using a style tag at the beginning of the markdown document:

For the case asked in the first message:

<style>
  body {  margin-right: 150px;}
</style>

Any valid CSS could be tried, like:

<style>
  @media print{@page {size: landscape}}
</style>
goyalyashpal commented 1 year ago

I came here in search of being able to specify the orientation (landscape) for an odd document.

the extension: jebbs.markdown-extended supports the following "per-file settings", i thought maybe yzane.markdown-pdf would be having something similar as well.

per-file settings inside markdown to override user settings - export-configurations at qjebbs/vscode-markdown-extended/REAMDE.md#L82

---
puppeteer:
    pdf:
        format: A4
        displayHeaderFooter: true
        margin:
            top: 1cm
            right: 1cm
            bottom: 1cm
            left: 1cm
    image:
        quality: 90
        fullPage: true
---

contents goes here...
reddishz commented 4 months ago

已实现。 #376