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

extend setting 'headerTemplate' with scope... #184

Closed ha5ch closed 4 years ago

ha5ch commented 4 years ago

.. scope: "resource" will able to setup separate .vscode/settings.json per workspace folder

with this small change single options can be set on workspace-folder level. An example: The following FOLDER structure

project_root
├── sub1
│   └── sub1.md
├── sub2
│   ├── sub2.md
│   └── .vscode
│       └── settings.json
├── root.md
└── .vscode
    └── settings.json

With a simple workspace (only one root), the settings of project_root/.vscode/settings.json will be used for all Markdown files. (if markdown-pdf.headerTemplate isn't set, Userlevel settings or Default settings will be used). At this point, same behaviour as now.

But when you add project_root/sub2 as separate folder to the workspace:

in that pull request, I only changed headerTemplate because currently this is the only option that I need. but you could also change the/some other options, to made them individual set able on workspace-root level!

This could maybe also a solution for #173


Extended Example

project_root/.vscode/settings.json

{
  "markdown-pdf.headerTemplate": "<div style=\"font-size: 9px; margin-left: 1cm;\">project_root level Header</div>"
}

project_root/.vscode/ws.code-workspace

{
  "folders": [
    {
      "path": "../"
    },
    {
      "path": "../sub1"
    },
    {
      "path": "../sub2"
    }
  ],
  "settings": {
    "markdown-pdf.headerTemplate": "<div style=\"font-size: 9px; margin-left: 1cm;\">workspace level Header</div>"
  }
}

project_root/sub2/.vscode/settings.json

{
  "markdown-pdf.headerTemplate": "<div style=\"font-size: 9px; margin-left: 1cm;\">sub2 individual Header</div>"
}

workspace root sub1 sub2

yzane commented 4 years ago

Thanks for your PR! Thank you for the detailed explanation.