{"id":15023138,"url":"https://github.com/prismicio-community/schnipsel","last_synced_at":"2025-07-31T03:38:31.012Z","repository":{"id":37729352,"uuid":"478920728","full_name":"prismicio-community/schnipsel","owner":"prismicio-community","description":"Write snippets once, render them for many IDEs","archived":false,"fork":false,"pushed_at":"2022-09-27T08:35:44.000Z","size":639,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-11T01:18:40.761Z","etag":null,"topics":["intellij","snippets","sublime-text","typescript","vim","vscode"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prismicio-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-07T09:44:23.000Z","updated_at":"2025-03-30T00:49:12.000Z","dependencies_parsed_at":"2022-09-16T05:50:32.025Z","dependency_job_id":null,"html_url":"https://github.com/prismicio-community/schnipsel","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/prismicio-community/schnipsel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prismicio-community%2Fschnipsel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prismicio-community%2Fschnipsel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prismicio-community%2Fschnipsel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prismicio-community%2Fschnipsel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prismicio-community","download_url":"https://codeload.github.com/prismicio-community/schnipsel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prismicio-community%2Fschnipsel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264880070,"owners_count":23677759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["intellij","snippets","sublime-text","typescript","vim","vscode"],"created_at":"2024-09-24T19:58:45.888Z","updated_at":"2025-07-20T11:31:52.505Z","avatar_url":"https://github.com/prismicio-community.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003c!--\n\nTODO: Go through all \"TODO\" comments in the project\n\nTODO: Replace all on all files (README.md, CONTRIBUTING.md, bug_report.md, package.json):\n- schnipsel\n- Write snippets once, render them for many IDEs\n- prismicio-community/schnipsel\n- schnipsel\n\n--\u003e\n\n# Schnipsel\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]\n[![Codecov][codecov-src]][codecov-href]\n[![Conventional Commits][conventional-commits-src]][conventional-commits-href]\n[![License][license-src]][license-href]\n\n\u003c!-- TODO: Replacing link to Prismic with [Prismic][prismic] is useful here --\u003e\n\nWrite snippets once, render them for many IDEs.\n\n\u003c!--\n\nTODO: Create a small list of package features:\n\n- 🤔 \u0026nbsp;A useful feature;\n- 🥴 \u0026nbsp;Another useful feature;\n- 🙃 \u0026nbsp;A final useful feature.\n\nNon-breaking space: \u0026nbsp; are here on purpose to fix emoji rendering on certain systems.\n\n--\u003e\n\n- ✍ \u0026nbsp;Write snippets once in Markdown;\n- 🚀 \u0026nbsp;Render them to many IDEs format (VS Code, Vim, Sublime, IntelliJ);\n- ⚙ \u0026nbsp;Flexible and typed configuration.\n\n## Install\n\n```bash\nnpm install schnipsel\n```\n\n## Documentation\n\nSchnipsel is a [CLI](#schnipsel-cli).\n\nIt reads configuration from a [`schnipsel.config.ts` file](#schnipselconfigts) to renders [input snippets](#snippet-file-format) to desired IDE formats.\n\n### `schnipsel` CLI\n\n```bash\n# Render project\nschnipsel\n\n# Render project in watch mode\nschnipsel --watch\nschnipsel -w\n\n# Init a schnipsel.config.ts file\nschnipsel init\n\n# Display help\nschnipsel --help\nschnipsel -h\n\n# Display version\nschnipsel --version\nschnipsel -v\n```\n\n### `schnipsel.config.ts`\n\n```typescript\nimport { defineSchnipselConfig } from \"schnipsel\";\n\nexport default defineSchnipselConfig({\n\t/**\n\t * Configures where and how Schnipsel should look for input files.\n\t */\n\tinput: {\n\t\t/**\n\t\t * Base directory where to look for input files, typically `./src`.\n\t\t */\n\t\tdirectory: \"src\",\n\n\t\t/**\n\t\t * An optional glob or glob array to match input files in `directory`.\n\t\t *\n\t\t * See Globby `patterns` parameter: https://github.com/sindresorhus/globby#patterns\n\t\t */\n\t\tglob: \"**/*.md\",\n\t},\n\n\t/**\n\t * Configures renderers that should be applied to found input files.\n\t */\n\trenderers: [\n\t\t{\n\t\t\t/**\n\t\t\t * Name of the renderer.\n\t\t\t * \n\t\t\t * Available:\n\t\t\t * \n\t\t\t * visualstudiocode, vscode, vim\n\t\t\t * sublimetext, sublime\n\t\t\t * intellijidea, intellij\n\t\t\t */\n\t\t\tname: \"vscode\",\n\n\t\t\t/**\n\t\t\t * Options to pass to the renderer.\n\t\t\t */\n\t\t\toptions: {\n\t\t\t\t/**\n\t\t\t\t * Output directory where to write rendered snippets.\n\t\t\t\t */\n\t\t\t\toutputDirectory: \"vscode/snippets\",\n\n\t\t\t\t/**\n\t\t\t\t * An optional map mapping input file paths from CWD to output file paths to\n\t\t\t\t * copy after render.\n\t\t\t\t */\n\t\t\t\tpassthroughFileCopy: {\n\t\t\t\t\t/**\n\t\t\t\t\t * Will copy the `./README.md` to `./vscode/snippets/README.md`\n\t\t\t\t\t */\n\t\t\t\t\t\"./README.md\": \"./vscode/README.md\",\n\t\t\t\t},\n\n\t\t\t\t/**\n\t\t\t\t * A map mapping input scopes to output scopes or a function receiving an\n\t\t\t\t * input scope and returning an output scope.\n\t\t\t\t *\n\t\t\t\t * See default scope resolver in: https://github.com/prismicio-community/schnipsel/blob/master/src/renderers/scopeResolvers.ts\n\t\t\t\t */\n\t\t\t\tscopeResolver: {\n\t\t\t\t\t/**\n\t\t\t\t\t * Snippet featuring the `xml` scope will render with the `text.xml` scope\n\t\t\t\t\t * for this renderer.\n\t\t\t\t\t */\n\t\t\t\t\txml: \"text.xml\"\n\t\t\t\t},\n\n\t\t\t\t// Only for VSCode renderer.\n\n\t\t\t\t/**\n\t\t\t\t * An optional path to a `package.json` file where to write the\n\t\t\t\t * `contributes.snippets` map of Visual Studio Code extensions.\n\t\t\t\t */\n\t\t\t\tpackageJSON: \"vscode/package.json\",\n\n\t\t\t\t// Only for IntelliJ renderer.\n\n\t\t\t\t/**\n\t\t\t\t * An optional path to a `plugin.xml` file where to write the `\u003cextensions /\u003e`\n\t\t\t\t * default live templates of an IntelliJ IDEA plugin.\n\t\t\t\t */\n\t\t\t\tpluginXML: \"intellij/src/main/resources/META-INF/plugin.xml\",\n\t\t\t},\n\t\t},\n\t],\n});\n```\n\nFor more information about Schnipsel configuration, see [src/types.ts](src/types.ts).\n\n### Snippet file format\n\n````markdown\n---\nname: \"Hello World\"\ndescription: \"Says hello to the world\"\nscopes: [\"typescript\"] # Scope(s) of the snippet. Uses VS Code's by default.\nprefix: \"helloWorld\" # What triggers the snippet to be suggested\n---\n\n\u003c!--\n\nA code block, everything inside will be the snippet content.\n\nUse `${1}` to define a tab stop.\nUse `${2:defaultValue}` to define a tab stop with a default value.\n\n--\u003e\n\n```typescript\nexport const hello${1:World} = (): void =\u003e {\n\tconsole.info(\"Hello ${1:World}!\");\n};\n```\n````\n\n### Recommended project structure\n\nSee [prismicio/prismic-snippets](https://github.com/prismicio/prismic-snippets) for an example project structure rendering and shipping snippets to multiple IDEs at once.\n\n---\n\nTo discover what's new on this package check out [the changelog][changelog]. \n\n## Contributing\n\nWhether you're helping us fix bugs, improve the docs, or spread the word, we'd love to have you as part of the Prismic developer community!\n\n**Asking a question**: [Open an issue][repo-bug-report] explaining what you want to achieve / your question. A maintainer will get back to you shortly.\n\n**Reporting a bug**: [Open an issue][repo-bug-report] explaining your application's setup and the bug you're encountering.\n\n**Suggesting an improvement**: [Open an issue][repo-feature-request] explaining your improvement or feature so we can discuss and learn more.\n\n**Submitting code changes**: For small fixes, feel free to [open a pull request][repo-pull-requests] with a description of your changes. For large changes, please first [open an issue][repo-feature-request] so we can discuss if and how the changes should be implemented.\n\nFor more clarity on this project and its structure you can also check out the detailed [CONTRIBUTING.md][contributing] document.\n\n## License\n\n```\n   Copyright 2013-2022 Prismic \u003ccontact@prismic.io\u003e (https://prismic.io)\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n\n\u003c!-- Links --\u003e\n\n\u003c!-- TODO: Replace link with a more useful one if available --\u003e\n\n[changelog]: ./CHANGELOG.md\n[contributing]: ./CONTRIBUTING.md\n\n\u003c!-- TODO: Replace link with a more useful one if available --\u003e\n\n[repo-bug-report]: https://github.com/prismicio-community/schnipsel/issues/new?assignees=\u0026labels=bug\u0026template=bug_report.md\u0026title=\n[repo-feature-request]: https://github.com/prismicio-community/schnipsel/issues/new?assignees=\u0026labels=enhancement\u0026template=feature_request.md\u0026title=\n[repo-pull-requests]: https://github.com/prismicio-community/schnipsel/pulls\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/schnipsel/latest.svg\n[npm-version-href]: https://npmjs.com/package/schnipsel\n[npm-downloads-src]: https://img.shields.io/npm/dm/schnipsel.svg\n[npm-downloads-href]: https://npmjs.com/package/schnipsel\n[github-actions-ci-src]: https://github.com/prismicio-community/schnipsel/workflows/ci/badge.svg\n[github-actions-ci-href]: https://github.com/prismicio-community/schnipsel/actions?query=workflow%3Aci\n[codecov-src]: https://img.shields.io/codecov/c/github/prismicio-community/schnipsel.svg\n[codecov-href]: https://codecov.io/gh/prismicio-community/schnipsel\n[conventional-commits-src]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg\n[conventional-commits-href]: https://conventionalcommits.org\n[license-src]: https://img.shields.io/npm/l/schnipsel.svg\n[license-href]: https://npmjs.com/package/schnipsel\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprismicio-community%2Fschnipsel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprismicio-community%2Fschnipsel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprismicio-community%2Fschnipsel/lists"}