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

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

Merged
merged 1 commit into from
Mar 18, 2020
Merged

Conversation

ha5ch
Copy link

@ha5ch ha5ch commented Mar 11, 2020

.. 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:

  • the settings of project_root/sub2/.vscode/settings.json will be used for project_root/sub2/sub2.md.
  • For project_root/root.md the settings from project_root/.vscode/settings.json will be used.
  • For project_root/sub1/sub1.md the Userlevel/default settings will be used, as long as you haven't set separate workspace level settings (inside the .code-workspace file for the loaded 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

.. scope: "resource" will able to setup separate .vscode/settings.json per workspace folder
@yzane yzane added this to the 1.4.4 milestone Mar 16, 2020
@yzane yzane merged commit 744f2a1 into yzane:master Mar 18, 2020
@yzane
Copy link
Owner

yzane commented Mar 18, 2020

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

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

Successfully merging this pull request may close these issues.

2 participants