# tree-sitter-hygen-template
[![CI][ci]](https://github.com/Hdoc1509/tree-sitter-hygen-template/actions/workflows/ci.yml)
[![discord][discord]](https://discord.gg/w7nTvsVJhm)
[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org)
[![crates][crates]](https://crates.io/crates/tree-sitter-hygen-template)
[![npm][npm]](https://www.npmjs.com/package/tree-sitter-hygen-template)
[![pypi][pypi]](https://pypi.org/project/tree-sitter-hygen-template)
[Tree-sitter](https://github.com/tree-sitter/tree-sitter) grammar for
[Hygen](https://github.com/jondot/hygen) templates.
It extends the [`tree-sitter-embedded-template`][embedded-template] grammar.
## Parser requirements
- [`bash`](https://github.com/tree-sitter/tree-sitter-bash) (optional):
highlight of `metadata.value` when `metadata.key` is `sh`
- [`javascript`](https://github.com/tree-sitter/tree-sitter-javascript)
(optional): highlight of `code` nodes
- [`regex`](https://github.com/tree-sitter/tree-sitter-regex) (optional):
highlight of `metadata.value` when `metadata.key` is `after`, `before` or
`skip_if`
- Any other parser that you want to use for [dynamic injection](#dynamic-injection)
## Usage in Editors
### Neovim
- [`hygen.nvim`](https://github.com/Hdoc1509/hygen.nvim): plugin that integrates
this grammar to your `Neovim` configuration.
### Helix
_To be added_
<!--
TODO: add script to add this grammar to Helix configuration. see:
- https://docs.helix-editor.com/guides/adding_languages.html
- https://docs.helix-editor.com/languages.html
take reference from:
https://github.com/IndianBoy42/tree-sitter-just?tab=readme-ov-file#manual-installation-helix
-->
### Emacs
_To be added_
<!--
TODO: take reference from:
https://github.com/tree-sitter-perl/tree-sitter-perl?tab=readme-ov-file#emacs
-->
### In General
You can get the built files from the [`release` branch][release-branch]. If you
have specific instructions for your editor, PR's are welcome.
## Dynamic Injection
Thanks to `content` node of [`tree-sitter-embedded-template`
grammar][embedded-template-grammar], dynamic injections can be attached to
template body.
### File naming convention
Just add `.hygen` to the end of the file name, i.e.:
- `index.html.hygen`
- `.gitignore.hygen`
- `.tsconfig.json.hygen`
### Tree-sitter directive
To implement dynamic injection, is recommended to create a directive with the
following name:
```txt
#inject-hygen-tmpl!
```
> [!NOTE]
> The creation of this directive varies for each editor
This directive will the responsible to remove `.hygen` from the file name and
use the rest of the file name to retrieve the `parser` to be used for dynamic
injection. See [implementations](#implementations) for more details.
> [!WARNING]
> Ignore dynamic injection for `*.ejs.hygen`, `*.erb.hygen` and `*.hygen.hygen`
> files to avoid weird behaviours
Once created, add it to the end of `injections.scm` file that will be used by
the editor:
```query
; dynamic injection
((content) @injection.content
(#inject-hygen-tmpl! "")
(#set! injection.combined))
```
## Implementations
### hygen.nvim
- [Filetype detection][hygen-nvim-filetype]
- [Parser register and injection directive][hygen-nvim-tree-sitter]
- [Dynamic injection query][hygen-nvim-injection-queries]
## References
- [Hygen repository](https://github.com/jondot/hygen)
- [Hygen website](https://www.hygen.io/) (_currently down_)
[ci]: https://github.com/Hdoc1509/tree-sitter-hygen-template/actions/workflows/ci.yml/badge.svg
[discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord
[matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix
[crates]: https://img.shields.io/crates/v/tree-sitter-hygen-template?logo=rust
[npm]: https://img.shields.io/npm/v/tree-sitter-hygen-template?logo=npm
[pypi]: https://img.shields.io/pypi/v/tree-sitter-hygen-template?logo=pypi&logoColor=ffd242
[embedded-template]: https://github.com/tree-sitter/tree-sitter-embedded-template
[embedded-template-grammar]: https://github.com/tree-sitter/tree-sitter-embedded-template/blob/master/grammar.js
[hygen-nvim-filetype]: https://github.com/Hdoc1509/hygen.nvim/blob/master/ftdetect/hygen.vim
[hygen-nvim-injection-queries]: https://github.com/Hdoc1509/hygen.nvim/blob/master/queries/hygen_template/injections.scm
[hygen-nvim-tree-sitter]: https://github.com/Hdoc1509/hygen.nvim/blob/master/lua/hygen/tree-sitter.lua
[release-branch]: https://github.com/Hdoc1509/tree-sitter-hygen-template/tree/release
Raw data
{
"_id": null,
"home_page": null,
"name": "tree-sitter-hygen-template",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "incremental, parsing, tree-sitter, hygen-template",
"author": null,
"author_email": "H\u00e9ctor Ochoa <hector.ochoa.dev@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/5f/e8/f6806742052afc6171e83fa659e0756db49f39f6e98903860030b901f934/tree_sitter_hygen_template-0.5.0.tar.gz",
"platform": null,
"description": "# tree-sitter-hygen-template\n\n[![CI][ci]](https://github.com/Hdoc1509/tree-sitter-hygen-template/actions/workflows/ci.yml)\n[![discord][discord]](https://discord.gg/w7nTvsVJhm)\n[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org)\n[![crates][crates]](https://crates.io/crates/tree-sitter-hygen-template)\n[![npm][npm]](https://www.npmjs.com/package/tree-sitter-hygen-template)\n[![pypi][pypi]](https://pypi.org/project/tree-sitter-hygen-template)\n\n[Tree-sitter](https://github.com/tree-sitter/tree-sitter) grammar for\n[Hygen](https://github.com/jondot/hygen) templates.\n\nIt extends the [`tree-sitter-embedded-template`][embedded-template] grammar.\n\n## Parser requirements\n\n- [`bash`](https://github.com/tree-sitter/tree-sitter-bash) (optional):\n highlight of `metadata.value` when `metadata.key` is `sh`\n- [`javascript`](https://github.com/tree-sitter/tree-sitter-javascript)\n (optional): highlight of `code` nodes\n- [`regex`](https://github.com/tree-sitter/tree-sitter-regex) (optional):\n highlight of `metadata.value` when `metadata.key` is `after`, `before` or\n `skip_if`\n- Any other parser that you want to use for [dynamic injection](#dynamic-injection)\n\n## Usage in Editors\n\n### Neovim\n\n- [`hygen.nvim`](https://github.com/Hdoc1509/hygen.nvim): plugin that integrates\n this grammar to your `Neovim` configuration.\n\n### Helix\n\n_To be added_\n\n<!--\nTODO: add script to add this grammar to Helix configuration. see:\n- https://docs.helix-editor.com/guides/adding_languages.html\n- https://docs.helix-editor.com/languages.html\ntake reference from:\nhttps://github.com/IndianBoy42/tree-sitter-just?tab=readme-ov-file#manual-installation-helix\n-->\n\n### Emacs\n\n_To be added_\n\n<!--\nTODO: take reference from:\nhttps://github.com/tree-sitter-perl/tree-sitter-perl?tab=readme-ov-file#emacs\n-->\n\n### In General\n\nYou can get the built files from the [`release` branch][release-branch]. If you\nhave specific instructions for your editor, PR's are welcome.\n\n## Dynamic Injection\n\nThanks to `content` node of [`tree-sitter-embedded-template`\ngrammar][embedded-template-grammar], dynamic injections can be attached to\ntemplate body.\n\n### File naming convention\n\nJust add `.hygen` to the end of the file name, i.e.:\n\n- `index.html.hygen`\n- `.gitignore.hygen`\n- `.tsconfig.json.hygen`\n\n### Tree-sitter directive\n\nTo implement dynamic injection, is recommended to create a directive with the\nfollowing name:\n\n```txt\n#inject-hygen-tmpl!\n```\n\n> [!NOTE]\n> The creation of this directive varies for each editor\n\nThis directive will the responsible to remove `.hygen` from the file name and\nuse the rest of the file name to retrieve the `parser` to be used for dynamic\ninjection. See [implementations](#implementations) for more details.\n\n> [!WARNING]\n> Ignore dynamic injection for `*.ejs.hygen`, `*.erb.hygen` and `*.hygen.hygen`\n> files to avoid weird behaviours\n\nOnce created, add it to the end of `injections.scm` file that will be used by\nthe editor:\n\n```query\n; dynamic injection\n((content) @injection.content\n (#inject-hygen-tmpl! \"\")\n (#set! injection.combined))\n```\n\n## Implementations\n\n### hygen.nvim\n\n- [Filetype detection][hygen-nvim-filetype]\n- [Parser register and injection directive][hygen-nvim-tree-sitter]\n- [Dynamic injection query][hygen-nvim-injection-queries]\n\n## References\n\n- [Hygen repository](https://github.com/jondot/hygen)\n- [Hygen website](https://www.hygen.io/) (_currently down_)\n\n[ci]: https://github.com/Hdoc1509/tree-sitter-hygen-template/actions/workflows/ci.yml/badge.svg\n[discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord\n[matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix\n[crates]: https://img.shields.io/crates/v/tree-sitter-hygen-template?logo=rust\n[npm]: https://img.shields.io/npm/v/tree-sitter-hygen-template?logo=npm\n[pypi]: https://img.shields.io/pypi/v/tree-sitter-hygen-template?logo=pypi&logoColor=ffd242\n[embedded-template]: https://github.com/tree-sitter/tree-sitter-embedded-template\n[embedded-template-grammar]: https://github.com/tree-sitter/tree-sitter-embedded-template/blob/master/grammar.js\n[hygen-nvim-filetype]: https://github.com/Hdoc1509/hygen.nvim/blob/master/ftdetect/hygen.vim\n[hygen-nvim-injection-queries]: https://github.com/Hdoc1509/hygen.nvim/blob/master/queries/hygen_template/injections.scm\n[hygen-nvim-tree-sitter]: https://github.com/Hdoc1509/hygen.nvim/blob/master/lua/hygen/tree-sitter.lua\n[release-branch]: https://github.com/Hdoc1509/tree-sitter-hygen-template/tree/release\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Hygen Template grammar for tree-sitter",
"version": "0.5.0",
"project_urls": {
"Homepage": "https://github.com/Hdoc1509/tree-sitter-hygen-template"
},
"split_keywords": [
"incremental",
" parsing",
" tree-sitter",
" hygen-template"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a9ff658057b5f999d0ee76c48ebb3df6181c977ad426f8c911c682387f6a6af5",
"md5": "6b9e50c5ffb19008283e92ed033ab5c3",
"sha256": "9dae82fe843f7b007d448c6355d207409b377dfde46377c6f15ec0384c822621"
},
"downloads": -1,
"filename": "tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_10_9_x86_64.whl",
"has_sig": false,
"md5_digest": "6b9e50c5ffb19008283e92ed033ab5c3",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 12122,
"upload_time": "2025-07-13T18:00:15",
"upload_time_iso_8601": "2025-07-13T18:00:15.612925Z",
"url": "https://files.pythonhosted.org/packages/a9/ff/658057b5f999d0ee76c48ebb3df6181c977ad426f8c911c682387f6a6af5/tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_10_9_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8e91fa1494fb7df6c11113d4f1d0a088fed44d4f74b40345401c8b1cb17df935",
"md5": "b8ec79613d0bb7464e08bf22324ef16e",
"sha256": "4ceb34fd1e080f8ca062e769b5b04dab3c6cfbdd83872c36efcb0e455b32c643"
},
"downloads": -1,
"filename": "tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "b8ec79613d0bb7464e08bf22324ef16e",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 12607,
"upload_time": "2025-07-13T18:00:16",
"upload_time_iso_8601": "2025-07-13T18:00:16.769090Z",
"url": "https://files.pythonhosted.org/packages/8e/91/fa1494fb7df6c11113d4f1d0a088fed44d4f74b40345401c8b1cb17df935/tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "55b912c3430f3eb7505edfe2f2292a92c1ee7db81f7142798280d980670d4c22",
"md5": "28226e9d5dc1aa240570012743dfa885",
"sha256": "58d0300bc008e22fdbf34ff944bfade24aa9855fec37848d5b25e464c78724a9"
},
"downloads": -1,
"filename": "tree_sitter_hygen_template-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "28226e9d5dc1aa240570012743dfa885",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 22207,
"upload_time": "2025-07-13T18:00:18",
"upload_time_iso_8601": "2025-07-13T18:00:18.408161Z",
"url": "https://files.pythonhosted.org/packages/55/b9/12c3430f3eb7505edfe2f2292a92c1ee7db81f7142798280d980670d4c22/tree_sitter_hygen_template-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "88e70479e45f1425eb9516bedcbcdc73d9e617990d125c29dfffa127c3eb7af7",
"md5": "a042437947cbbdec837b8d59a319eed5",
"sha256": "2fe9574957252ca85bf6d08e30734e4411c9f1099544396f7426d1e8749b6c26"
},
"downloads": -1,
"filename": "tree_sitter_hygen_template-0.5.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "a042437947cbbdec837b8d59a319eed5",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 21977,
"upload_time": "2025-07-13T18:00:19",
"upload_time_iso_8601": "2025-07-13T18:00:19.444827Z",
"url": "https://files.pythonhosted.org/packages/88/e7/0479e45f1425eb9516bedcbcdc73d9e617990d125c29dfffa127c3eb7af7/tree_sitter_hygen_template-0.5.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4684e9ad34f404672e018727e9f6d8c39060fb10667018f2d05140299f787902",
"md5": "7aa63f52c00a9cd5838a37a71fbad912",
"sha256": "04cbd818bd66e305b3ff13f283ec98e480b066ff563ccd715511d8ceb6026249"
},
"downloads": -1,
"filename": "tree_sitter_hygen_template-0.5.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "7aa63f52c00a9cd5838a37a71fbad912",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 20976,
"upload_time": "2025-07-13T18:00:20",
"upload_time_iso_8601": "2025-07-13T18:00:20.489234Z",
"url": "https://files.pythonhosted.org/packages/46/84/e9ad34f404672e018727e9f6d8c39060fb10667018f2d05140299f787902/tree_sitter_hygen_template-0.5.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e35a5644217890454528b101f3d46d0a7e52601e72b804c17ee1b5ddf755aa0e",
"md5": "c0805b062e51bdb8c98cb5fcb5d1b9eb",
"sha256": "c5631d370418d782720a914253e404acd93496f8bdb4f86addc989789305afaa"
},
"downloads": -1,
"filename": "tree_sitter_hygen_template-0.5.0-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "c0805b062e51bdb8c98cb5fcb5d1b9eb",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 14947,
"upload_time": "2025-07-13T18:00:21",
"upload_time_iso_8601": "2025-07-13T18:00:21.408985Z",
"url": "https://files.pythonhosted.org/packages/e3/5a/5644217890454528b101f3d46d0a7e52601e72b804c17ee1b5ddf755aa0e/tree_sitter_hygen_template-0.5.0-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "219f8dc5b7af22c158dba4d0f1c1ac980f48ceb5b9f63a8a738d6d55944c43ae",
"md5": "74ea20311964ba17ab98fb021d704198",
"sha256": "ab649ed3d005bdf362ec65c0a546c2520e507fca630a505d023f977631830e47"
},
"downloads": -1,
"filename": "tree_sitter_hygen_template-0.5.0-cp39-abi3-win_arm64.whl",
"has_sig": false,
"md5_digest": "74ea20311964ba17ab98fb021d704198",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 13861,
"upload_time": "2025-07-13T18:00:22",
"upload_time_iso_8601": "2025-07-13T18:00:22.397635Z",
"url": "https://files.pythonhosted.org/packages/21/9f/8dc5b7af22c158dba4d0f1c1ac980f48ceb5b9f63a8a738d6d55944c43ae/tree_sitter_hygen_template-0.5.0-cp39-abi3-win_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5fe8f6806742052afc6171e83fa659e0756db49f39f6e98903860030b901f934",
"md5": "f8d1fac780863972aa7a4908f48893db",
"sha256": "ea899949d2ae36aabe948f20fb4a20c0f2a7c5bb195e2c68c0c5cd1295bce04f"
},
"downloads": -1,
"filename": "tree_sitter_hygen_template-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "f8d1fac780863972aa7a4908f48893db",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 11702,
"upload_time": "2025-07-13T18:00:23",
"upload_time_iso_8601": "2025-07-13T18:00:23.081714Z",
"url": "https://files.pythonhosted.org/packages/5f/e8/f6806742052afc6171e83fa659e0756db49f39f6e98903860030b901f934/tree_sitter_hygen_template-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-13 18:00:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Hdoc1509",
"github_project": "tree-sitter-hygen-template",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tree-sitter-hygen-template"
}