JakubAndrysek / mkdocs-open-in-new-tab

🔮 This plugin adds JS to open outgoing links and PDFs in a new tab.
https://newtab.kubaandrysek.cz/
MIT License
24 stars 3 forks source link

VSCode yaml.schemas does not support open-in-new-tab #5

Open sebpretzer opened 3 months ago

sebpretzer commented 3 months ago

Issue:

I am using VSCode Intellisense to validate mkdocs.yml, as described here: https://squidfunk.github.io/mkdocs-material/creating-your-site/#minimal-configuration for .vscode/settings.json:

"yaml.schemas": {
        "https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
    },

When attempting to use the plugin in mkdocs.yml like so:

plugins:
  - open-in-new-tab

I get the following error:

image

click for copy pasted error ``` Value is not accepted. Valid values: "blog", "info", "meta", "offline", "optimize", "privacy", "projects", "search", "social", "tags", "typeset", "git-authors", "git-committers", "git-revision-date", "literate-nav", "macros", "section-index", "include-markdown", "material-relative-language-selector", "rss", "git-revision-date-localized", "glightbox", "meta-descriptions", "mkdocstrings", "coverage", "spellcheck", "markdown-exec", "table-reader".yaml-schema: Built-in blog plugin | Built-in info plugin | Built-in meta plugin | Built-in offline plugin | Built-in optimize plugin | Built-in privacy plugin | Built-in projects plugin | Built-in search plugin | Built-in social plugin | Built-in tags plugin | Built-in typeset plugin | Generate pages during the build | Add git authors to pages | Add git contributors to pages | Add git revision date to pages | Configure navigation in Markdown instead of YAML | Use variables and macros in Markdown | Add index section pages to navigation(1) Plugins || Plugins || Plugins Built-in plugins || External plugins, schema provided by us || External plugins, schema provided by our community Allowed Values: - include-markdown - material-relative-language-selector - rss - git-revision-date-localized - glightbox - meta-descriptions - mkdocstrings - coverage - spellcheck - markdown-exec - table-reader Source: [schema.json](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html) ```

Potential Solutions:

I am unclear on the best way to resolve this. Please let me know what you think is the best solution.

1. Add to the official schema

Based on the conversation in https://github.com/squidfunk/mkdocs-material/discussions/3660, it seems like squidfunk would prefer that users use his insider's plugin, which would be understandable. I doubt he would support adding this to the official schema, like done in https://github.com/squidfunk/mkdocs-material/issues/6378. But I can attempt to do so, if that is the easier solution.

2. Override .vscode/settings.json

An alternative could be to override yaml.customTags, which would silence the error. Although I am not sure how format it in a way that would silence it. I tried a few different patterns like described in https://github.com/redhat-developer/vscode-yaml/issues/137 but could not get it to silence. This is an educated guess as a possible solution, but guidance would be needed on how to implement.

JakubAndrysek commented 3 months ago

Hi, thank you for providing the information. I will look at it next week.

JakubAndrysek commented 3 months ago

List of supported plugins: https://github.com/squidfunk/mkdocs-material/blob/4ba7a6db51029b346f7ac1fecc1c99e46654cade/docs/schema/plugins.json#L4

https://squidfunk.github.io/mkdocs-material/schema/plugins.json

JakubAndrysek commented 3 months ago

I have added https://github.com/JakubAndrysek/mkdocs-open-in-new-tab/blob/main/schema.json

It seems to work well after adding it to material repo - locally image

JakubAndrysek commented 3 months ago

@sebpretzer After I add schema to all of my plugins, I will create PR to mkdocs-material repo.