{"id":16987217,"url":"https://github.com/yorickpeterse/inko-syntax","last_synced_at":"2025-06-11T19:38:09.326Z","repository":{"id":193962955,"uuid":"689785932","full_name":"yorickpeterse/inko-syntax","owner":"yorickpeterse","description":"A syntax highlighting library for Inko","archived":false,"fork":false,"pushed_at":"2025-02-21T20:45:05.000Z","size":141,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-21T21:44:44.622Z","etag":null,"topics":["inko","pygments","syntax","syntax-highlighting"],"latest_commit_sha":null,"homepage":"https://yorickpeterse.github.io/inko-syntax/","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yorickpeterse.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"yorickpeterse"}},"created_at":"2023-09-10T22:16:44.000Z","updated_at":"2025-02-21T20:45:07.000Z","dependencies_parsed_at":"2023-09-11T02:44:48.085Z","dependency_job_id":"392b7816-4470-4017-9eeb-7252e87c794e","html_url":"https://github.com/yorickpeterse/inko-syntax","commit_stats":null,"previous_names":["yorickpeterse/inko-syntax"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yorickpeterse%2Finko-syntax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yorickpeterse%2Finko-syntax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yorickpeterse%2Finko-syntax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yorickpeterse%2Finko-syntax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yorickpeterse","download_url":"https://codeload.github.com/yorickpeterse/inko-syntax/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244894325,"owners_count":20527677,"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":["inko","pygments","syntax","syntax-highlighting"],"created_at":"2024-10-14T02:48:33.417Z","updated_at":"2025-03-22T02:12:14.346Z","avatar_url":"https://github.com/yorickpeterse.png","language":"Makefile","funding_links":["https://github.com/sponsors/yorickpeterse"],"categories":["others"],"sub_categories":[],"readme":"# inko-syntax\n\nA simple syntax highlighting library for [Inko](https://inko-lang.org), with\n[Pygments](https://pygments.org/) compatible HTML output.\n\nThis library focuses solely on syntax highlighting, and doesn't provide any\nmeans to detect a language/lexer to use according to a file extension, filename,\nMIME type, or the file contents.\n\n## Requirements\n\n- Inko 0.18.0 or newer\n\n## Installation\n\n```bash\ninko pkg add github.com/yorickpeterse/inko-syntax 0.18.0\ninko pkg sync\n```\n\n## Supported languages\n\n- [C](https://www.open-std.org/jtc1/sc22/wg14/): `c` (aliased as `cpp`)\n- [Fish](https://fishshell.com/): `fish`\n- [Inko](https://inko-lang.org/): `inko`\n- [Make](https://www.gnu.org/software/make/): `make`\n- [Ruby](https://www.ruby-lang.org/en/): `ruby`\n- [Rust](https://www.rust-lang.org/): `rust`\n- Shell: `shell` (aliases as `bash`, `sh`, `zsh`, `ksh`)\n- [TOML](https://toml.io/): `toml`\n\n## Supported formats\n\n- Pygments compatible HTML\n\n## Usage\n\nA basic example:\n\n```inko\nimport std.stdio (STDOUT)\nimport syntax (Languages)\nimport syntax.format (Html)\n\nclass async Main {\n  fn async main {\n    # The `Languages` type is a registry of the available languages. This type\n    # makes it easy to create a lexer for a language, without having to\n    # explicitly import the underlying types into your code.\n    let langs = Languages.new\n\n    # This gets a language for the given name, returning a `None` if the name\n    # isn't recognized.\n    let lang = langs.get('inko').unwrap\n\n    # Now we can create a lexer and format it. Lexers take an immutable\n    # reference to a `ByteArray`, so we need to keep it around until we've\n    # produced the token stream.\n    let bytes = '# This is a test'.to_byte_array\n    let lexer = lang.lexer(bytes)\n\n    # The `Html` formatter takes a lexer and turns it into Pygments compatible\n    # HTML document fragment.\n    let html = Html.new.format(lexer)\n\n    STDOUT.new.print(html.to_string)\n  }\n}\n```\n\nThe output of this is the following HTML (formatted manually to increase\nreadability):\n\n```html\n\u003cdiv class=\"highlight\"\u003e\n  \u003cpre class=\"highlight\"\u003e\u003ccode\u003e\u003cspan class=\"c\"\u003e# This is a test\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\n\u003c/div\u003e\n```\n\nFor more information, refer to the [API\ndocumentation](https://yorickpeterse.github.io/inko-syntax/).\n\n## License\n\nAll source code in this repository is licensed under the Mozilla Public License\nversion 2.0, unless stated otherwise. A copy of this license can be found in the\nfile \"LICENSE\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyorickpeterse%2Finko-syntax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyorickpeterse%2Finko-syntax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyorickpeterse%2Finko-syntax/lists"}