Skip to main content

Hygen Template grammar for tree-sitter

Project description

tree-sitter-hygen-template

CI discord matrix crates npm pypi

Tree-sitter grammar for Hygen templates.

It extends the tree-sitter-embedded-template grammar.

Parser requirements

  • bash (optional): highlight of metadata.value when metadata.key is sh
  • javascript (optional): highlight of code nodes
  • 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

Usage in Editors

Neovim

  • hygen.nvim: plugin that integrates this grammar to your Neovim configuration.

Helix

To be added

Emacs

To be added

In General

You can get the built files from the 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, 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:

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

; dynamic injection
((content) @injection.content
  (#inject-hygen-tmpl! "")
  (#set! injection.combined))

Implementations

hygen.nvim

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_hygen_template-0.5.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_hygen_template-0.5.0-cp39-abi3-win_arm64.whl (13.9 kB view details)

Uploaded CPython 3.9+Windows ARM64

tree_sitter_hygen_template-0.5.0-cp39-abi3-win_amd64.whl (14.9 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_hygen_template-0.5.0-cp39-abi3-musllinux_1_2_x86_64.whl (21.0 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

tree_sitter_hygen_template-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (22.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

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 (22.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_11_0_arm64.whl (12.6 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_10_9_x86_64.whl (12.1 kB view details)

Uploaded CPython 3.9+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_hygen_template-0.5.0.tar.gz.

File metadata

File hashes

Hashes for tree_sitter_hygen_template-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ea899949d2ae36aabe948f20fb4a20c0f2a7c5bb195e2c68c0c5cd1295bce04f
MD5 f8d1fac780863972aa7a4908f48893db
BLAKE2b-256 5fe8f6806742052afc6171e83fa659e0756db49f39f6e98903860030b901f934

See more details on using hashes here.

File details

Details for the file tree_sitter_hygen_template-0.5.0-cp39-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_hygen_template-0.5.0-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 ab649ed3d005bdf362ec65c0a546c2520e507fca630a505d023f977631830e47
MD5 74ea20311964ba17ab98fb021d704198
BLAKE2b-256 219f8dc5b7af22c158dba4d0f1c1ac980f48ceb5b9f63a8a738d6d55944c43ae

See more details on using hashes here.

File details

Details for the file tree_sitter_hygen_template-0.5.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_hygen_template-0.5.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c5631d370418d782720a914253e404acd93496f8bdb4f86addc989789305afaa
MD5 c0805b062e51bdb8c98cb5fcb5d1b9eb
BLAKE2b-256 e35a5644217890454528b101f3d46d0a7e52601e72b804c17ee1b5ddf755aa0e

See more details on using hashes here.

File details

Details for the file tree_sitter_hygen_template-0.5.0-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_hygen_template-0.5.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 04cbd818bd66e305b3ff13f283ec98e480b066ff563ccd715511d8ceb6026249
MD5 7aa63f52c00a9cd5838a37a71fbad912
BLAKE2b-256 4684e9ad34f404672e018727e9f6d8c39060fb10667018f2d05140299f787902

See more details on using hashes here.

File details

Details for the file tree_sitter_hygen_template-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_hygen_template-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 58d0300bc008e22fdbf34ff944bfade24aa9855fec37848d5b25e464c78724a9
MD5 28226e9d5dc1aa240570012743dfa885
BLAKE2b-256 55b912c3430f3eb7505edfe2f2292a92c1ee7db81f7142798280d980670d4c22

See more details on using hashes here.

File details

Details for the file 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.

File metadata

File hashes

Hashes for 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
Algorithm Hash digest
SHA256 2fe9574957252ca85bf6d08e30734e4411c9f1099544396f7426d1e8749b6c26
MD5 a042437947cbbdec837b8d59a319eed5
BLAKE2b-256 88e70479e45f1425eb9516bedcbcdc73d9e617990d125c29dfffa127c3eb7af7

See more details on using hashes here.

File details

Details for the file tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ceb34fd1e080f8ca062e769b5b04dab3c6cfbdd83872c36efcb0e455b32c643
MD5 b8ec79613d0bb7464e08bf22324ef16e
BLAKE2b-256 8e91fa1494fb7df6c11113d4f1d0a088fed44d4f74b40345401c8b1cb17df935

See more details on using hashes here.

File details

Details for the file tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_hygen_template-0.5.0-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9dae82fe843f7b007d448c6355d207409b377dfde46377c6f15ec0384c822621
MD5 6b9e50c5ffb19008283e92ed033ab5c3
BLAKE2b-256 a9ff658057b5f999d0ee76c48ebb3df6181c977ad426f8c911c682387f6a6af5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page