{"id":22222002,"url":"https://github.com/fabiospampinato/textmate-highlighter","last_synced_at":"2025-08-02T06:05:28.447Z","repository":{"id":206336608,"uuid":"716414461","full_name":"fabiospampinato/textmate-highlighter","owner":"fabiospampinato","description":"An isomorphic syntax highlighter using TextMate grammars and VSCode themes.","archived":false,"fork":false,"pushed_at":"2024-12-14T00:55:12.000Z","size":33,"stargazers_count":54,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-23T09:51:05.969Z","etag":null,"topics":["grammar","highlighting","syntax","textmate","theme","vscode"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fabiospampinato.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"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":"fabiospampinato","custom":"https://www.paypal.me/fabiospampinato"}},"created_at":"2023-11-09T04:47:32.000Z","updated_at":"2025-01-23T13:54:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"780438c7-7230-4f66-909a-4e89950f7393","html_url":"https://github.com/fabiospampinato/textmate-highlighter","commit_stats":null,"previous_names":["fabiospampinato/highmate","fabiospampinato/textmate-highlighter"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/fabiospampinato/textmate-highlighter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftextmate-highlighter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftextmate-highlighter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftextmate-highlighter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftextmate-highlighter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/textmate-highlighter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftextmate-highlighter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268071081,"owners_count":24191003,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["grammar","highlighting","syntax","textmate","theme","vscode"],"created_at":"2024-12-02T23:16:30.602Z","updated_at":"2025-08-02T06:05:28.417Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","funding_links":["https://github.com/sponsors/fabiospampinato","https://www.paypal.me/fabiospampinato"],"categories":[],"sub_categories":[],"readme":"# TextMate Highlighter\n\nAn isomorphic syntax highlighter using TextMate grammars and VSCode themes.\n\nThis is very similar in approach to [`Shiki`](https://github.com/octref/shiki), which you should probably use instead if it works well for you.\n\n## Features\n\n- It works both in browsers and in server-side environments (HTML and ANSI renderers only).\n- It's unopinionated about how Oniguruma, grammars and themes are loaded or from where.\n- It supports various built-in rendering targets: HTML, DOM, ANSI and CSS Custom Highlights.\n- It supports a low-level tokenization mode, for custom render targets.\n- It tries not to block the main thread for a long time, yielding back control every now and then.\n\n## Install\n\n```sh\nnpm install --save textmate-highlighter\n```\n\n## Usage\n\n```ts\nimport Highlighter from 'textmate-highlighter';\n\n// First of all let's define where to get grammars, themes and Onigiruma from\n// You can also pre-fetch some these objects on your own if you want, we'll use URLs here for simplicity\n// You can name your grammars differently, but internally some grammars will reference other grammars using these names, so you should registered them like this\n\nconst ONIGURUMA = 'https://unpkg.com/vscode-oniguruma@2.0.1/release/onig.wasm';\n\nconst GRAMMARS = {\n  'source.abap': 'https://unpkg.com/shiki@^0.14.5/languages/abap.tmLanguage.json',\n  'source.actionscript.3': 'https://unpkg.com/shiki@^0.14.5/languages/actionscript-3.tmLanguage.json',\n  'source.ada': 'https://unpkg.com/shiki@^0.14.5/languages/ada.tmLanguage.json',\n  'source.apacheconf': 'https://unpkg.com/shiki@^0.14.5/languages/apache.tmLanguage.json',\n  'source.apex': 'https://unpkg.com/shiki@^0.14.5/languages/apex.tmLanguage.json',\n  'source.apl': 'https://unpkg.com/shiki@^0.14.5/languages/apl.tmLanguage.json',\n  'source.applescript': 'https://unpkg.com/shiki@^0.14.5/languages/applescript.tmLanguage.json',\n  'source.ara': 'https://unpkg.com/shiki@^0.14.5/languages/ara.tmLanguage.json',\n  'source.asm.x86_64': 'https://unpkg.com/shiki@^0.14.5/languages/asm.tmLanguage.json',\n  'source.astro': 'https://unpkg.com/shiki@^0.14.5/languages/astro.tmLanguage.json',\n  'source.awk': 'https://unpkg.com/shiki@^0.14.5/languages/awk.tmLanguage.json',\n  'source.ballerina': 'https://unpkg.com/shiki@^0.14.5/languages/ballerina.tmLanguage.json',\n  'source.batchfile': 'https://unpkg.com/shiki@^0.14.5/languages/bat.tmLanguage.json',\n  'text.beancount': 'https://unpkg.com/shiki@^0.14.5/languages/beancount.tmLanguage.json',\n  'source.berry': 'https://unpkg.com/shiki@^0.14.5/languages/berry.tmLanguage.json',\n  'text.bibtex': 'https://unpkg.com/shiki@^0.14.5/languages/bibtex.tmLanguage.json',\n  'source.bicep': 'https://unpkg.com/shiki@^0.14.5/languages/bicep.tmLanguage.json',\n  'text.html.php.blade': 'https://unpkg.com/shiki@^0.14.5/languages/blade.tmLanguage.json',\n  'source.c': 'https://unpkg.com/shiki@^0.14.5/languages/c.tmLanguage.json',\n  'source.cadence': 'https://unpkg.com/shiki@^0.14.5/languages/cadence.tmLanguage.json',\n  'source.clar': 'https://unpkg.com/shiki@^0.14.5/languages/clarity.tmLanguage.json',\n  'source.clojure': 'https://unpkg.com/shiki@^0.14.5/languages/clojure.tmLanguage.json',\n  'source.cmake': 'https://unpkg.com/shiki@^0.14.5/languages/cmake.tmLanguage.json',\n  'source.cobol': 'https://unpkg.com/shiki@^0.14.5/languages/cobol.tmLanguage.json',\n  'source.ql': 'https://unpkg.com/shiki@^0.14.5/languages/codeql.tmLanguage.json',\n  'source.coffee': 'https://unpkg.com/shiki@^0.14.5/languages/coffee.tmLanguage.json',\n  'source.cpp.embedded.macro': 'https://unpkg.com/shiki@^0.14.5/languages/cpp-macro.tmLanguage.json',\n  'source.cpp': 'https://unpkg.com/shiki@^0.14.5/languages/cpp.tmLanguage.json',\n  'source.crystal': 'https://unpkg.com/shiki@^0.14.5/languages/crystal.tmLanguage.json',\n  'source.cs': 'https://unpkg.com/shiki@^0.14.5/languages/csharp.tmLanguage.json',\n  'source.css': 'https://unpkg.com/shiki@^0.14.5/languages/css.tmLanguage.json',\n  'source.cue': 'https://unpkg.com/shiki@^0.14.5/languages/cue.tmLanguage.json',\n  'source.cypher': 'https://unpkg.com/shiki@^0.14.5/languages/cypher.tmLanguage.json',\n  'source.d': 'https://unpkg.com/shiki@^0.14.5/languages/d.tmLanguage.json',\n  'source.dart': 'https://unpkg.com/shiki@^0.14.5/languages/dart.tmLanguage.json',\n  'source.dax': 'https://unpkg.com/shiki@^0.14.5/languages/dax.tmLanguage.json',\n  'source.diff': 'https://unpkg.com/shiki@^0.14.5/languages/diff.tmLanguage.json',\n  'source.dockerfile': 'https://unpkg.com/shiki@^0.14.5/languages/docker.tmLanguage.json',\n  'source.dm': 'https://unpkg.com/shiki@^0.14.5/languages/dream-maker.tmLanguage.json',\n  'source.elixir': 'https://unpkg.com/shiki@^0.14.5/languages/elixir.tmLanguage.json',\n  'source.elm': 'https://unpkg.com/shiki@^0.14.5/languages/elm.tmLanguage.json',\n  'text.html.erb': 'https://unpkg.com/shiki@^0.14.5/languages/erb.tmLanguage.json',\n  'source.erlang': 'https://unpkg.com/shiki@^0.14.5/languages/erlang.tmLanguage.json',\n  'source.fish': 'https://unpkg.com/shiki@^0.14.5/languages/fish.tmLanguage.json',\n  'source.fsharp': 'https://unpkg.com/shiki@^0.14.5/languages/fsharp.tmLanguage.json',\n  'source.gdresource': 'https://unpkg.com/shiki@^0.14.5/languages/gdresource.tmLanguage.json',\n  'source.gdscript': 'https://unpkg.com/shiki@^0.14.5/languages/gdscript.tmLanguage.json',\n  'source.gdshader': 'https://unpkg.com/shiki@^0.14.5/languages/gdshader.tmLanguage.json',\n  'text.gherkin.feature': 'https://unpkg.com/shiki@^0.14.5/languages/gherkin.tmLanguage.json',\n  'text.git-commit': 'https://unpkg.com/shiki@^0.14.5/languages/git-commit.tmLanguage.json',\n  'text.git-rebase': 'https://unpkg.com/shiki@^0.14.5/languages/git-rebase.tmLanguage.json',\n  'source.gjs': 'https://unpkg.com/shiki@^0.14.5/languages/glimmer-js.tmLanguage.json',\n  'source.gts': 'https://unpkg.com/shiki@^0.14.5/languages/glimmer-ts.tmLanguage.json',\n  'source.glsl': 'https://unpkg.com/shiki@^0.14.5/languages/glsl.tmLanguage.json',\n  'source.gnuplot': 'https://unpkg.com/shiki@^0.14.5/languages/gnuplot.tmLanguage.json',\n  'source.go': 'https://unpkg.com/shiki@^0.14.5/languages/go.tmLanguage.json',\n  'source.graphql': 'https://unpkg.com/shiki@^0.14.5/languages/graphql.tmLanguage.json',\n  'source.groovy': 'https://unpkg.com/shiki@^0.14.5/languages/groovy.tmLanguage.json',\n  'source.hack': 'https://unpkg.com/shiki@^0.14.5/languages/hack.tmLanguage.json',\n  'text.haml': 'https://unpkg.com/shiki@^0.14.5/languages/haml.tmLanguage.json',\n  'text.html.handlebars': 'https://unpkg.com/shiki@^0.14.5/languages/handlebars.tmLanguage.json',\n  'source.haskell': 'https://unpkg.com/shiki@^0.14.5/languages/haskell.tmLanguage.json',\n  'source.hcl': 'https://unpkg.com/shiki@^0.14.5/languages/hcl.tmLanguage.json',\n  'source.hjson': 'https://unpkg.com/shiki@^0.14.5/languages/hjson.tmLanguage.json',\n  'source.hlsl': 'https://unpkg.com/shiki@^0.14.5/languages/hlsl.tmLanguage.json',\n  'text.html.basic': 'https://unpkg.com/shiki@^0.14.5/languages/html.tmLanguage.json',\n  'source.http': 'https://unpkg.com/shiki@^0.14.5/languages/http.tmLanguage.json',\n  'source.imba': 'https://unpkg.com/shiki@^0.14.5/languages/imba.tmLanguage.json',\n  'source.ini': 'https://unpkg.com/shiki@^0.14.5/languages/ini.tmLanguage.json',\n  'source.java': 'https://unpkg.com/shiki@^0.14.5/languages/java.tmLanguage.json',\n  'source.js': 'https://unpkg.com/shiki@^0.14.5/languages/javascript.tmLanguage.json',\n  'text.html.jinja': 'https://unpkg.com/shiki@^0.14.5/languages/jinja-html.tmLanguage.json',\n  'source.jinja': 'https://unpkg.com/shiki@^0.14.5/languages/jinja.tmLanguage.json',\n  'source.jison': 'https://unpkg.com/shiki@^0.14.5/languages/jison.tmLanguage.json',\n  'source.json': 'https://unpkg.com/shiki@^0.14.5/languages/json.tmLanguage.json',\n  'source.json5': 'https://unpkg.com/shiki@^0.14.5/languages/json5.tmLanguage.json',\n  'source.json.comments': 'https://unpkg.com/shiki@^0.14.5/languages/jsonc.tmLanguage.json',\n  'source.json.lines': 'https://unpkg.com/shiki@^0.14.5/languages/jsonl.tmLanguage.json',\n  'source.jsonnet': 'https://unpkg.com/shiki@^0.14.5/languages/jsonnet.tmLanguage.json',\n  'source.jssm': 'https://unpkg.com/shiki@^0.14.5/languages/jssm.tmLanguage.json',\n  'source.js.jsx': 'https://unpkg.com/shiki@^0.14.5/languages/jsx.tmLanguage.json',\n  'source.julia': 'https://unpkg.com/shiki@^0.14.5/languages/julia.tmLanguage.json',\n  'source.kotlin': 'https://unpkg.com/shiki@^0.14.5/languages/kotlin.tmLanguage.json',\n  'source.kusto': 'https://unpkg.com/shiki@^0.14.5/languages/kusto.tmLanguage.json',\n  'text.tex.latex': 'https://unpkg.com/shiki@^0.14.5/languages/latex.tmLanguage.json',\n  'source.css.less': 'https://unpkg.com/shiki@^0.14.5/languages/less.tmLanguage.json',\n  'text.html.liquid': 'https://unpkg.com/shiki@^0.14.5/languages/liquid.tmLanguage.json',\n  'source.lisp': 'https://unpkg.com/shiki@^0.14.5/languages/lisp.tmLanguage.json',\n  'source.logo': 'https://unpkg.com/shiki@^0.14.5/languages/logo.tmLanguage.json',\n  'source.lua': 'https://unpkg.com/shiki@^0.14.5/languages/lua.tmLanguage.json',\n  'source.makefile': 'https://unpkg.com/shiki@^0.14.5/languages/make.tmLanguage.json',\n  'text.html.markdown': 'https://unpkg.com/shiki@^0.14.5/languages/markdown.tmLanguage.json',\n  'text.marko': 'https://unpkg.com/shiki@^0.14.5/languages/marko.tmLanguage.json',\n  'source.matlab': 'https://unpkg.com/shiki@^0.14.5/languages/matlab.tmLanguage.json',\n  'text.markdown.mdc': 'https://unpkg.com/shiki@^0.14.5/languages/mdc.tmLanguage.json',\n  'source.mdx': 'https://unpkg.com/shiki@^0.14.5/languages/mdx.tmLanguage.json',\n  'source.mermaid': 'https://unpkg.com/shiki@^0.14.5/languages/mermaid.tmLanguage.json',\n  'source.mojo': 'https://unpkg.com/shiki@^0.14.5/languages/mojo.tmLanguage.json',\n  'source.narrat': 'https://unpkg.com/shiki@^0.14.5/languages/narrat.tmLanguage.json',\n  'source.nextflow': 'https://unpkg.com/shiki@^0.14.5/languages/nextflow.tmLanguage.json',\n  'source.nginx': 'https://unpkg.com/shiki@^0.14.5/languages/nginx.tmLanguage.json',\n  'source.nim': 'https://unpkg.com/shiki@^0.14.5/languages/nim.tmLanguage.json',\n  'source.nix': 'https://unpkg.com/shiki@^0.14.5/languages/nix.tmLanguage.json',\n  'source.objc': 'https://unpkg.com/shiki@^0.14.5/languages/objective-c.tmLanguage.json',\n  'source.objcpp': 'https://unpkg.com/shiki@^0.14.5/languages/objective-cpp.tmLanguage.json',\n  'source.ocaml': 'https://unpkg.com/shiki@^0.14.5/languages/ocaml.tmLanguage.json',\n  'source.pascal': 'https://unpkg.com/shiki@^0.14.5/languages/pascal.tmLanguage.json',\n  'source.perl': 'https://unpkg.com/shiki@^0.14.5/languages/perl.tmLanguage.json',\n  'text.html.php': 'https://unpkg.com/shiki@^0.14.5/languages/php-html.tmLanguage.json',\n  'source.php': 'https://unpkg.com/shiki@^0.14.5/languages/php.tmLanguage.json',\n  'source.plsql.oracle': 'https://unpkg.com/shiki@^0.14.5/languages/plsql.tmLanguage.json',\n  'source.css.postcss': 'https://unpkg.com/shiki@^0.14.5/languages/postcss.tmLanguage.json',\n  'source.powerquery': 'https://unpkg.com/shiki@^0.14.5/languages/powerquery.tmLanguage.json',\n  'source.powershell': 'https://unpkg.com/shiki@^0.14.5/languages/powershell.tmLanguage.json',\n  'source.prisma': 'https://unpkg.com/shiki@^0.14.5/languages/prisma.tmLanguage.json',\n  'source.prolog': 'https://unpkg.com/shiki@^0.14.5/languages/prolog.tmLanguage.json',\n  'source.proto': 'https://unpkg.com/shiki@^0.14.5/languages/proto.tmLanguage.json',\n  'text.pug': 'https://unpkg.com/shiki@^0.14.5/languages/pug.tmLanguage.json',\n  'source.puppet': 'https://unpkg.com/shiki@^0.14.5/languages/puppet.tmLanguage.json',\n  'source.purescript': 'https://unpkg.com/shiki@^0.14.5/languages/purescript.tmLanguage.json',\n  'source.python': 'https://unpkg.com/shiki@^0.14.5/languages/python.tmLanguage.json',\n  'source.r': 'https://unpkg.com/shiki@^0.14.5/languages/r.tmLanguage.json',\n  'source.perl.6': 'https://unpkg.com/shiki@^0.14.5/languages/raku.tmLanguage.json',\n  'text.aspnetcorerazor': 'https://unpkg.com/shiki@^0.14.5/languages/razor.tmLanguage.json',\n  'source.reg': 'https://unpkg.com/shiki@^0.14.5/languages/reg.tmLanguage.json',\n  'source.rel': 'https://unpkg.com/shiki@^0.14.5/languages/rel.tmLanguage.json',\n  'source.riscv': 'https://unpkg.com/shiki@^0.14.5/languages/riscv.tmLanguage.json',\n  'source.rst': 'https://unpkg.com/shiki@^0.14.5/languages/rst.tmLanguage.json',\n  'source.ruby': 'https://unpkg.com/shiki@^0.14.5/languages/ruby.tmLanguage.json',\n  'source.rust': 'https://unpkg.com/shiki@^0.14.5/languages/rust.tmLanguage.json',\n  'source.sas': 'https://unpkg.com/shiki@^0.14.5/languages/sas.tmLanguage.json',\n  'source.sass': 'https://unpkg.com/shiki@^0.14.5/languages/sass.tmLanguage.json',\n  'source.scala': 'https://unpkg.com/shiki@^0.14.5/languages/scala.tmLanguage.json',\n  'source.scheme': 'https://unpkg.com/shiki@^0.14.5/languages/scheme.tmLanguage.json',\n  'source.css.scss': 'https://unpkg.com/shiki@^0.14.5/languages/scss.tmLanguage.json',\n  'source.shaderlab': 'https://unpkg.com/shiki@^0.14.5/languages/shaderlab.tmLanguage.json',\n  'source.shell': 'https://unpkg.com/shiki@^0.14.5/languages/shellscript.tmLanguage.json',\n  'text.shell-session': 'https://unpkg.com/shiki@^0.14.5/languages/shellsession.tmLanguage.json',\n  'source.smalltalk': 'https://unpkg.com/shiki@^0.14.5/languages/smalltalk.tmLanguage.json',\n  'source.solidity': 'https://unpkg.com/shiki@^0.14.5/languages/solidity.tmLanguage.json',\n  'source.sparql': 'https://unpkg.com/shiki@^0.14.5/languages/sparql.tmLanguage.json',\n  'source.splunk_search': 'https://unpkg.com/shiki@^0.14.5/languages/splunk.tmLanguage.json',\n  'source.sql': 'https://unpkg.com/shiki@^0.14.5/languages/sql.tmLanguage.json',\n  'source.ssh-config': 'https://unpkg.com/shiki@^0.14.5/languages/ssh-config.tmLanguage.json',\n  'source.stata': 'https://unpkg.com/shiki@^0.14.5/languages/stata.tmLanguage.json',\n  'source.stylus': 'https://unpkg.com/shiki@^0.14.5/languages/stylus.tmLanguage.json',\n  'source.svelte': 'https://unpkg.com/shiki@^0.14.5/languages/svelte.tmLanguage.json',\n  'source.swift': 'https://unpkg.com/shiki@^0.14.5/languages/swift.tmLanguage.json',\n  'source.systemverilog': 'https://unpkg.com/shiki@^0.14.5/languages/system-verilog.tmLanguage.json',\n  'source.tasl': 'https://unpkg.com/shiki@^0.14.5/languages/tasl.tmLanguage.json',\n  'source.tcl': 'https://unpkg.com/shiki@^0.14.5/languages/tcl.tmLanguage.json',\n  'text.tex': 'https://unpkg.com/shiki@^0.14.5/languages/tex.tmLanguage.json',\n  'source.toml': 'https://unpkg.com/shiki@^0.14.5/languages/toml.tmLanguage.json',\n  'source.tsx': 'https://unpkg.com/shiki@^0.14.5/languages/tsx.tmLanguage.json',\n  'source.turtle': 'https://unpkg.com/shiki@^0.14.5/languages/turtle.tmLanguage.json',\n  'text.html.twig': 'https://unpkg.com/shiki@^0.14.5/languages/twig.tmLanguage.json',\n  'source.ts': 'https://unpkg.com/shiki@^0.14.5/languages/typescript.tmLanguage.json',\n  'source.v': 'https://unpkg.com/shiki@^0.14.5/languages/v.tmLanguage.json',\n  'source.asp.vb.net': 'https://unpkg.com/shiki@^0.14.5/languages/vb.tmLanguage.json',\n  'source.verilog': 'https://unpkg.com/shiki@^0.14.5/languages/verilog.tmLanguage.json',\n  'source.vhdl': 'https://unpkg.com/shiki@^0.14.5/languages/vhdl.tmLanguage.json',\n  'source.viml': 'https://unpkg.com/shiki@^0.14.5/languages/viml.tmLanguage.json',\n  'text.html.vue-html': 'https://unpkg.com/shiki@^0.14.5/languages/vue-html.tmLanguage.json',\n  'source.vue': 'https://unpkg.com/shiki@^0.14.5/languages/vue.tmLanguage.json',\n  'source.vyper': 'https://unpkg.com/shiki@^0.14.5/languages/vyper.tmLanguage.json',\n  'source.wat': 'https://unpkg.com/shiki@^0.14.5/languages/wasm.tmLanguage.json',\n  'source.wenyan': 'https://unpkg.com/shiki@^0.14.5/languages/wenyan.tmLanguage.json',\n  'source.wgsl': 'https://unpkg.com/shiki@^0.14.5/languages/wgsl.tmLanguage.json',\n  'source.wolfram': 'https://unpkg.com/shiki@^0.14.5/languages/wolfram.tmLanguage.json',\n  'text.xml': 'https://unpkg.com/shiki@^0.14.5/languages/xml.tmLanguage.json',\n  'text.xml.xsl': 'https://unpkg.com/shiki@^0.14.5/languages/xsl.tmLanguage.json',\n  'source.yaml': 'https://unpkg.com/shiki@^0.14.5/languages/yaml.tmLanguage.json',\n  'source.zenscript': 'https://unpkg.com/shiki@^0.14.5/languages/zenscript.tmLanguage.json',\n  'source.zig': 'https://unpkg.com/shiki@^0.14.5/languages/zig.tmLanguage.json'\n};\n\nconst THEMES = {\n  'css-variables': 'https://unpkg.com/shiki@^0.14.5/themes/css-variables.json',\n  'dark-plus': 'https://unpkg.com/shiki@^0.14.5/themes/dark-plus.json',\n  'dracula-soft': 'https://unpkg.com/shiki@^0.14.5/themes/dracula-soft.json',\n  'dracula': 'https://unpkg.com/shiki@^0.14.5/themes/dracula.json',\n  'github-dark-dimmed': 'https://unpkg.com/shiki@^0.14.5/themes/github-dark-dimmed.json',\n  'github-dark': 'https://unpkg.com/shiki@^0.14.5/themes/github-dark.json',\n  'github-light': 'https://unpkg.com/shiki@^0.14.5/themes/github-light.json',\n  'hc_light': 'https://unpkg.com/shiki@^0.14.5/themes/hc_light.json',\n  'light-plus': 'https://unpkg.com/shiki@^0.14.5/themes/light-plus.json',\n  'material-theme-darker': 'https://unpkg.com/shiki@^0.14.5/themes/material-theme-darker.json',\n  'material-theme-lighter': 'https://unpkg.com/shiki@^0.14.5/themes/material-theme-lighter.json',\n  'material-theme-ocean': 'https://unpkg.com/shiki@^0.14.5/themes/material-theme-ocean.json',\n  'material-theme-palenight': 'https://unpkg.com/shiki@^0.14.5/themes/material-theme-palenight.json',\n  'material-theme': 'https://unpkg.com/shiki@^0.14.5/themes/material-theme.json',\n  'min-dark': 'https://unpkg.com/shiki@^0.14.5/themes/min-dark.json',\n  'min-light': 'https://unpkg.com/shiki@^0.14.5/themes/min-light.json',\n  'monokai': 'https://unpkg.com/shiki@^0.14.5/themes/monokai.json',\n  'nord': 'https://unpkg.com/shiki@^0.14.5/themes/nord.json',\n  'one-dark-pro': 'https://unpkg.com/shiki@^0.14.5/themes/one-dark-pro.json',\n  'poimandres': 'https://unpkg.com/shiki@^0.14.5/themes/poimandres.json',\n  'rose-pine-dawn': 'https://unpkg.com/shiki@^0.14.5/themes/rose-pine-dawn.json',\n  'rose-pine-moon': 'https://unpkg.com/shiki@^0.14.5/themes/rose-pine-moon.json',\n  'rose-pine': 'https://unpkg.com/shiki@^0.14.5/themes/rose-pine.json',\n  'slack-dark': 'https://unpkg.com/shiki@^0.14.5/themes/slack-dark.json',\n  'slack-ochin': 'https://unpkg.com/shiki@^0.14.5/themes/slack-ochin.json',\n  'solarized-dark': 'https://unpkg.com/shiki@^0.14.5/themes/solarized-dark.json',\n  'solarized-light': 'https://unpkg.com/shiki@^0.14.5/themes/solarized-light.json',\n  'vitesse-dark': 'https://unpkg.com/shiki@^0.14.5/themes/vitesse-dark.json',\n  'vitesse-light': 'https://unpkg.com/shiki@^0.14.5/themes/vitesse-light.json'\n};\n\n// Now let's instantiate the highlighter\n\nconst highlighter = new Highlighter ({\n  getGrammar: grammar =\u003e {\n    console.log ( 'Loading grammar:', grammar );\n    return GRAMMARS[grammar];\n  },\n  getTheme: theme =\u003e {\n    console.log ( 'Loading theme:', theme );\n    return THEMES[theme];\n  },\n  getOniguruma: () =\u003e {\n    return ONIGURUMA;\n  }\n});\n\n// Rendering some code to HTML\n\nconst html = await highlighter.highlightToHTML ({\n  code: 'const foo = \"bar\";',\n  grammar: 'source.js',\n  theme: 'github-dark'\n});\n\n// Rendering some code to DOM nodes directly (client-only)\n\nconst node = await highlighter.highlightToDOM ({\n  code: 'const foo = \"bar\";',\n  grammar: 'source.js',\n  theme: 'github-dark'\n});\n\n// Rendering some code to ANSI, for the terminal\n\nconst ansi = await highlighter.highlightToANSI ({\n  code: 'const foo = \"bar\";',\n  grammar: 'source.js',\n  theme: 'github-dark'\n});\n\n// Rendering some code to a single \u003cpre\u003e element containing a single Text node (client-only)\n\nconst [node, dispose] = await highlighter.highlightToHighlights ({\n  code: 'const foo = \"bar\";',\n  grammar: 'source.js',\n  theme: 'github-dark'\n});\n\ndispose (); // The dispose function cleans up all the CSS Custom Highlights, allowing the nodes to be garbage collected\n\n// Doing low-level tokenization\n\nconst lines = [\n  'function sum ( a, b ) {',\n  '  return a + b;',\n  '}'\n];\n\nconst abortController = new AbortController ();\nconst abortSignal = abortController.signal;\n\nconst linesTokens = await highlighter.tokenize ( lines, 'source.js', 'github-dark', abortSignal, ( lineTokens, lineIndex ) =\u003e {\n  console.log ( 'Line tokens:', lineTokens );\n  console.log ( 'Line index:', lineIndex );\n});\n```\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Ftextmate-highlighter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Ftextmate-highlighter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Ftextmate-highlighter/lists"}