{"id":18063000,"url":"https://github.com/stagas/code-syntax","last_synced_at":"2025-04-05T13:12:55.654Z","repository":{"id":57202179,"uuid":"438489269","full_name":"stagas/code-syntax","owner":"stagas","description":"Code syntax highlight Web Component","archived":false,"fork":false,"pushed_at":"2022-08-01T14:02:41.000Z","size":183,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-12T09:09:27.614Z","etag":null,"topics":["custom-element","highlight","syntax","web-component"],"latest_commit_sha":null,"homepage":"https://stagas.github.io/code-syntax/","language":"Jest Snapshot","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/stagas.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}},"created_at":"2021-12-15T04:04:18.000Z","updated_at":"2023-02-04T22:53:53.000Z","dependencies_parsed_at":"2022-09-17T12:01:15.252Z","dependency_job_id":null,"html_url":"https://github.com/stagas/code-syntax","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":"stagas/ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stagas%2Fcode-syntax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stagas%2Fcode-syntax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stagas%2Fcode-syntax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stagas%2Fcode-syntax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stagas","download_url":"https://codeload.github.com/stagas/code-syntax/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339160,"owners_count":20923014,"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":["custom-element","highlight","syntax","web-component"],"created_at":"2024-10-31T05:09:07.748Z","updated_at":"2025-04-05T13:12:55.628Z","avatar_url":"https://github.com/stagas.png","language":"Jest Snapshot","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\ncode-syntax \u003ca href=\"https://npmjs.org/package/code-syntax\"\u003e\u003cimg src=\"https://img.shields.io/badge/npm-v4.0.0-F00.svg?colorA=000\"/\u003e\u003c/a\u003e \u003ca href=\"src\"\u003e\u003cimg src=\"https://img.shields.io/badge/loc-519-FFF.svg?colorA=000\"/\u003e\u003c/a\u003e \u003ca href=\"https://cdn.jsdelivr.net/npm/code-syntax@4.0.0/dist/code-syntax.min.js\"\u003e\u003cimg src=\"https://img.shields.io/badge/brotli-16.4K-333.svg?colorA=000\"/\u003e\u003c/a\u003e \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-F0B.svg?colorA=000\"/\u003e\u003c/a\u003e\n\u003c/h1\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\nCode syntax highlight Web Component\n\n\u003ch4\u003e\n\u003ctable\u003e\u003ctr\u003e\u003ctd title=\"Triple click to select and copy paste\"\u003e\n\u003ccode\u003enpm i code-syntax \u003c/code\u003e\n\u003c/td\u003e\u003ctd title=\"Triple click to select and copy paste\"\u003e\n\u003ccode\u003epnpm add code-syntax \u003c/code\u003e\n\u003c/td\u003e\u003ctd title=\"Triple click to select and copy paste\"\u003e\n\u003ccode\u003eyarn add code-syntax\u003c/code\u003e\n\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\u003c/h4\u003e\n\n## Examples\n\n\u003cdetails id=\"example$web\" title=\"web\" open\u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#example$web\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eweb\u003c/strong\u003e\u003c/code\u003e\u003c/summary\u003e  \u003cul\u003e\u003cp\u003e\u003c/p\u003e  \u003ca href=\"https://stagas.github.io/code-syntax/example/web.html\"\u003e\u003cimg width=\"436.57142857142856\" src=\"example/web.png\"\u003e\u003c/img\u003e  \u003cp\u003e\u003cstrong\u003eTry it live\u003c/strong\u003e\u003c/p\u003e\u003c/a\u003e    \u003cdetails id=\"source$web\" title=\"web source code\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#source$web\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eview source\u003c/strong\u003e\u003c/code\u003e\u003c/summary\u003e  \u003ca href=\"example/web.ts\"\u003eexample/web.ts\u003c/a\u003e  \u003cp\u003e\n\n```ts\nimport 'plenty-themes/cobalt2.css'\nimport 'plenty-themes/laser.css'\nimport 'code-syntax/themes/default.css'\n\nimport { CodeSyntaxElement, languages } from 'code-syntax'\nimport js from 'code-syntax/languages/js'\n\ncustomElements.define('code-syntax', CodeSyntaxElement)\n\nlanguages.js = js // can also be import(code-syntax.) directly\n\ndocument.body.innerHTML = `\n\u003ccode-syntax id=\"demo\" style=\"display:inline-flex;\" language=\"js\" theme=\"laser\"\u003eclass Vector {\n  x: number\n  y: number\n  constructor(x: number, y: number) {\n    this.x = x\n    this.y = y\n  }\n  add(v: Vector): Vector {\n    return new Vector(this.x + v.x, this.y + v.y)\n  }\n}\n\u003c/code-syntax\u003e\n`\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\u003c/ul\u003e\u003c/details\u003e\n\n## API\n\n\u003cp\u003e  \u003cdetails id=\"CodeSyntaxElement$12\" title=\"Class\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#CodeSyntaxElement$12\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eCodeSyntaxElement\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/element.ts#L45\"\u003esrc/element.ts#L45\u003c/a\u003e  \u003cul\u003e        \u003cp\u003e  \u003cdetails id=\"constructor$13\" title=\"Constructor\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#constructor$13\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003econstructor\u003c/strong\u003e\u003c/code\u003e\u003cem\u003e()\u003c/em\u003e    \u003c/summary\u003e    \u003cul\u003e    \u003cp\u003e  \u003cdetails id=\"new CodeSyntaxElement$14\" title=\"ConstructorSignature\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#new CodeSyntaxElement$14\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003enew CodeSyntaxElement\u003c/strong\u003e\u003c/code\u003e\u003cem\u003e()\u003c/em\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003ca href=\"#CodeSyntaxElement$12\"\u003eCodeSyntaxElement\u003c/a\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"codeHTML$20\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#codeHTML$20\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ecodeHTML\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/element.ts#L53\"\u003esrc/element.ts#L53\u003c/a\u003e  \u003cul\u003e\u003cp\u003estring\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"codeRawText$21\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#codeRawText$21\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ecodeRawText\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/element.ts#L54\"\u003esrc/element.ts#L54\u003c/a\u003e  \u003cul\u003e\u003cp\u003estring\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"codeRef$19\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#codeRef$19\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ecodeRef\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/element.ts#L52\"\u003esrc/element.ts#L52\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003cspan\u003eHTMLElement\u003c/span\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"highlight$22\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#highlight$22\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ehighlight\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/element.ts#L55\"\u003esrc/element.ts#L55\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003cdetails id=\"__type$23\" title=\"Function\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#__type$23\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003cem\u003e(s)\u003c/em\u003e    \u003c/summary\u003e    \u003cul\u003e    \u003cp\u003e    \u003cdetails id=\"s$25\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#s$25\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003es\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003estring\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003e\u003c/strong\u003e\u003cem\u003e(s)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003estring\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"language$16\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#language$16\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003elanguage\u003c/strong\u003e\u003c/code\u003e  \u003cspan\u003e\u003cspan\u003e\u0026nbsp;=\u0026nbsp;\u003c/span\u003e  \u003ccode\u003e$.String\u003c/code\u003e\u003c/span\u003e  \u003c/summary\u003e  \u003ca href=\"src/element.ts#L48\"\u003esrc/element.ts#L48\u003c/a\u003e  \u003cul\u003e\u003cp\u003eundefined | string\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"onTextContent$26\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#onTextContent$26\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eonTextContent\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/element.ts#L56\"\u003esrc/element.ts#L56\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003cdetails id=\"__type$27\" title=\"Function\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#__type$27\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003cem\u003e(textContent)\u003c/em\u003e    \u003c/summary\u003e    \u003cul\u003e    \u003cp\u003e    \u003cdetails id=\"textContent$29\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#textContent$29\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003etextContent\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003estring\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003e\u003c/strong\u003e\u003cem\u003e(textContent)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003evoid\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"onmounted$42\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#onmounted$42\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eonmounted\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003eEventHandler\u003c/span\u003e\u0026lt;\u003ca href=\"#CodeSyntaxElement$12\"\u003eCodeSyntaxElement\u003c/a\u003e, \u003cspan\u003eCustomEvent\u003c/span\u003e\u0026lt;any\u0026gt;\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"onunmounted$43\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#onunmounted$43\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eonunmounted\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003eEventHandler\u003c/span\u003e\u0026lt;\u003ca href=\"#CodeSyntaxElement$12\"\u003eCodeSyntaxElement\u003c/a\u003e, \u003cspan\u003eCustomEvent\u003c/span\u003e\u0026lt;any\u0026gt;\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"root$15\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#root$15\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eroot\u003c/strong\u003e\u003c/code\u003e  \u003cspan\u003e\u003cspan\u003e\u0026nbsp;=\u0026nbsp;\u003c/span\u003e  \u003ccode\u003e...\u003c/code\u003e\u003c/span\u003e  \u003c/summary\u003e  \u003ca href=\"src/element.ts#L46\"\u003esrc/element.ts#L46\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003cspan\u003eShadowRoot\u003c/span\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"syntax$18\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#syntax$18\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003esyntax\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/element.ts#L51\"\u003esrc/element.ts#L51\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003ca href=\"#SyntaxOrImport$8\"\u003eSyntaxOrImport\u003c/a\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"theme$17\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#theme$17\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003etheme\u003c/strong\u003e\u003c/code\u003e  \u003cspan\u003e\u003cspan\u003e\u0026nbsp;=\u0026nbsp;\u003c/span\u003e  \u003ccode\u003e$.String\u003c/code\u003e\u003c/span\u003e  \u003c/summary\u003e  \u003ca href=\"src/element.ts#L49\"\u003esrc/element.ts#L49\u003c/a\u003e  \u003cul\u003e\u003cp\u003eundefined | string\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"mounted$30\" title=\"Method\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#mounted$30\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003emounted\u003c/strong\u003e\u003c/code\u003e\u003cem\u003e($)\u003c/em\u003e    \u003c/summary\u003e  \u003ca href=\"src/element.ts#L58\"\u003esrc/element.ts#L58\u003c/a\u003e  \u003cul\u003e    \u003cp\u003e    \u003cdetails id=\"$$32\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#$$32\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003e$\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003eContext\u003c/span\u003e\u0026lt;\u003ca href=\"#CodeSyntaxElement$12\"\u003eCodeSyntaxElement\u003c/a\u003e \u0026amp; \u003cspan\u003eJsxContext\u003c/span\u003e\u0026lt;\u003ca href=\"#CodeSyntaxElement$12\"\u003eCodeSyntaxElement\u003c/a\u003e\u0026gt; \u0026amp; \u003cspan\u003eOmit\u003c/span\u003e\u0026lt;{\u003cp\u003e    \u003cdetails id=\"ctor$36\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#ctor$36\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ector\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003eClass\u003c/span\u003e\u0026lt;\u003ca href=\"#T$35\"\u003eT\u003c/a\u003e\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003e\u003c/strong\u003e\u0026lt;\u003cspan\u003eT\u003c/span\u003e\u0026gt;\u003cem\u003e(ctor)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003e\u003cspan\u003eCleanClass\u003c/span\u003e\u0026lt;\u003ca href=\"#T$35\"\u003eT\u003c/a\u003e\u0026gt;\u003c/ul\u003e\u003c/p\u003e  \u003cdetails id=\"ctx$40\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#ctx$40\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ectx\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003ca href=\"#T$39\"\u003eT\u003c/a\u003e | \u003cspan\u003eClass\u003c/span\u003e\u0026lt;\u003ca href=\"#T$39\"\u003eT\u003c/a\u003e\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003e\u003c/strong\u003e\u0026lt;\u003cspan\u003eT\u003c/span\u003e\u0026gt;\u003cem\u003e(ctx)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003e\u003cspan\u003eWrapper\u003c/span\u003e\u0026lt;\u003ca href=\"#T$39\"\u003eT\u003c/a\u003e\u0026gt;\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e} \u0026amp; \u003cspan\u003e__module\u003c/span\u003e \u0026amp; {}, \u003ccode\u003e\"transition\"\u003c/code\u003e\u0026gt;\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003emounted\u003c/strong\u003e\u003cem\u003e($)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003evoid\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e\u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"PatchOptions$53\" title=\"Interface\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#PatchOptions$53\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ePatchOptions\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/util.ts#L3\"\u003esrc/util.ts#L3\u003c/a\u003e  \u003cul\u003e        \u003cp\u003e  \u003cdetails id=\"theme$54\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#theme$54\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003etheme\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/util.ts#L4\"\u003esrc/util.ts#L4\u003c/a\u003e  \u003cul\u003e\u003cp\u003estring\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"getLanguage$55\" title=\"Method\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#getLanguage$55\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003egetLanguage\u003c/strong\u003e\u003c/code\u003e\u003cem\u003e(el)\u003c/em\u003e    \u003c/summary\u003e  \u003ca href=\"src/util.ts#L5\"\u003esrc/util.ts#L5\u003c/a\u003e  \u003cul\u003e    \u003cp\u003e    \u003cdetails id=\"el$57\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#el$57\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eel\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003eElement\u003c/span\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003egetLanguage\u003c/strong\u003e\u003cem\u003e(el)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003estring\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e\u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"SyntaxDefinition$5\" title=\"Interface\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#SyntaxDefinition$5\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eSyntaxDefinition\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/syntax.ts#L6\"\u003esrc/syntax.ts#L6\u003c/a\u003e  \u003cul\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"RegExpMap$44\" title=\"TypeAlias\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#RegExpMap$44\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eRegExpMap\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/syntax.ts#L3\"\u003esrc/syntax.ts#L3\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003cspan\u003eRecord\u003c/span\u003e\u0026lt;string, \u003ca href=\"#RegExpMapped$1\"\u003eRegExpMapped\u003c/a\u003e\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"RegExpMapped$1\" title=\"TypeAlias\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#RegExpMapped$1\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eRegExpMapped\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/syntax.ts#L4\"\u003esrc/syntax.ts#L4\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003cspan\u003eRegExp\u003c/span\u003e \u0026amp; {\u003cp\u003e  \u003cdetails id=\"keys$4\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#keys$4\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ekeys\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/syntax.ts#L4\"\u003esrc/syntax.ts#L4\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003cspan\u003eSet\u003c/span\u003e\u0026lt;string\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"map$3\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#map$3\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003emap\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/syntax.ts#L4\"\u003esrc/syntax.ts#L4\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003ca href=\"#RegExpMap$44\"\u003eRegExpMap\u003c/a\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e}\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"SyntaxOrImport$8\" title=\"TypeAlias\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#SyntaxOrImport$8\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eSyntaxOrImport\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/syntax.ts#L10\"\u003esrc/syntax.ts#L10\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003ca href=\"#SyntaxDefinition$5\"\u003eSyntaxDefinition\u003c/a\u003e | \u003cspan\u003ePromise\u003c/span\u003e\u0026lt;{\u003cp\u003e  \u003cdetails id=\"default$10\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#default$10\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003edefault\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"src/syntax.ts#L10\"\u003esrc/syntax.ts#L10\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003ca href=\"#SyntaxDefinition$5\"\u003eSyntaxDefinition\u003c/a\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e}\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"languages$11\" title=\"Variable\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#languages$11\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003elanguages\u003c/strong\u003e\u003c/code\u003e  \u003cspan\u003e\u003cspan\u003e\u0026nbsp;=\u0026nbsp;\u003c/span\u003e  \u003ccode\u003e{}\u003c/code\u003e\u003c/span\u003e  \u003c/summary\u003e  \u003ca href=\"src/element.ts#L8\"\u003esrc/element.ts#L8\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003cspan\u003eRecord\u003c/span\u003e\u0026lt;string, \u003ca href=\"#SyntaxOrImport$8\"\u003eSyntaxOrImport\u003c/a\u003e\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"compile$45\" title=\"Function\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#compile$45\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ecompile\u003c/strong\u003e\u003c/code\u003e\u003cem\u003e(def, keys)\u003c/em\u003e     \u0026ndash; Compiles a syntax definition.\u003c/summary\u003e  \u003ca href=\"src/syntax.ts#L24\"\u003esrc/syntax.ts#L24\u003c/a\u003e  \u003cul\u003e    \u003cp\u003e  \u003cp\u003e\n\n```js\nconst r = await compile({\n  foo: /[a-z]/,\n  bar: /[0-9]/,\n})\n```\n\n\u003c/p\u003e\n  \u003cdetails id=\"def$47\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#def$47\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003edef\u003c/strong\u003e\u003c/code\u003e     \u0026ndash; The syntax definition to compile. Can be a promise returned by \u003ccode\u003eimport()\u003c/code\u003e.\n\u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003ca href=\"#SyntaxOrImport$8\"\u003eSyntaxOrImport\u003c/a\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"keys$48\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#keys$48\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ekeys\u003c/strong\u003e\u003c/code\u003e  \u003cspan\u003e\u003cspan\u003e\u0026nbsp;=\u0026nbsp;\u003c/span\u003e  \u003ccode\u003e...\u003c/code\u003e\u003c/span\u003e  \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003eSet\u003c/span\u003e\u0026lt;string\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003ecompile\u003c/strong\u003e\u003cem\u003e(def, keys)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003e\u003cspan\u003ePromise\u003c/span\u003e\u0026lt;\u003ca href=\"#RegExpMapped$1\"\u003eRegExpMapped\u003c/a\u003e\u0026gt;\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"patchElements$58\" title=\"Function\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#patchElements$58\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003epatchElements\u003c/strong\u003e\u003c/code\u003e\u003cem\u003e(elements, \u003cspan\u003ePartial\u003c/span\u003e\u0026lt;\u003ca href=\"#PatchOptions$53\"\u003ePatchOptions\u003c/a\u003e\u0026gt;)\u003c/em\u003e    \u003c/summary\u003e  \u003ca href=\"src/util.ts#L8\"\u003esrc/util.ts#L8\u003c/a\u003e  \u003cul\u003e    \u003cp\u003e    \u003cdetails id=\"elements$60\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#elements$60\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eelements\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003eElement\u003c/span\u003e  []\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cspan\u003ePartial\u003c/span\u003e\u0026lt;\u003ca href=\"#PatchOptions$53\"\u003ePatchOptions\u003c/a\u003e\u0026gt;  \u003cp\u003e\u003cstrong\u003epatchElements\u003c/strong\u003e\u003cem\u003e(elements, \u003cspan\u003ePartial\u003c/span\u003e\u0026lt;\u003ca href=\"#PatchOptions$53\"\u003ePatchOptions\u003c/a\u003e\u0026gt;)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003evoid\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"patchPreCodeElements$62\" title=\"Function\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#patchPreCodeElements$62\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003epatchPreCodeElements\u003c/strong\u003e\u003c/code\u003e\u003cem\u003e(opts)\u003c/em\u003e    \u003c/summary\u003e  \u003ca href=\"src/util.ts#L27\"\u003esrc/util.ts#L27\u003c/a\u003e  \u003cul\u003e    \u003cp\u003e    \u003cdetails id=\"opts$64\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#opts$64\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eopts\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003ePartial\u003c/span\u003e\u0026lt;\u003ca href=\"#PatchOptions$53\"\u003ePatchOptions\u003c/a\u003e\u0026gt;\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003epatchPreCodeElements\u003c/strong\u003e\u003cem\u003e(opts)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003evoid\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"syntax$49\" title=\"Function\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#syntax$49\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003esyntax\u003c/strong\u003e\u003c/code\u003e\u003cem\u003e(regexp, s)\u003c/em\u003e     \u0026ndash; Syntax highlights a string as html with the given syntax.\u003c/summary\u003e  \u003ca href=\"src/syntax.ts#L68\"\u003esrc/syntax.ts#L68\u003c/a\u003e  \u003cul\u003e    \u003cp\u003e  \u003cp\u003e\n\n```js\nconst regexp = await compile({\n  foo: /[a-z]+/,\n  bar: [\n    /[0-9]+/,\n    {\n      bar: /[0-5]+/,\n    },\n  ],\n})\nconst html = syntax(regexp, 'hello 123 789 world')\n```\n\n\u003c/p\u003e\n  \u003cdetails id=\"regexp$51\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#regexp$51\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eregexp\u003c/strong\u003e\u003c/code\u003e     \u0026ndash; The syntax definition returned by \u003ccode\u003ecompile()\u003c/code\u003e\u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003eRegExp\u003c/span\u003e | \u003ca href=\"#RegExpMapped$1\"\u003eRegExpMapped\u003c/a\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"s$52\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#s$52\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003es\u003c/strong\u003e\u003c/code\u003e     \u0026ndash; The string to highlight.\n\u003c/summary\u003e    \u003cul\u003e\u003cp\u003estring\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003esyntax\u003c/strong\u003e\u003cem\u003e(regexp, s)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003estring\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e\n\n## Credits\n\n- [html-escaper](https://npmjs.org/package/html-escaper) by [Andrea Giammarchi](https://github.com/WebReflection) \u0026ndash; fast and safe way to escape and unescape \u0026\u003c\u003e'\" chars\n- [sigl](https://npmjs.org/package/sigl) by [stagas](https://github.com/stagas) \u0026ndash; Web framework\n\n## Contributing\n\n[Fork](https://github.com/stagas/code-syntax/fork) or [edit](https://github.dev/stagas/code-syntax) and submit a PR.\n\nAll contributions are welcome!\n\n## License\n\n\u003ca href=\"LICENSE\"\u003eMIT\u003c/a\u003e \u0026copy; 2022 [stagas](https://github.com/stagas)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstagas%2Fcode-syntax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstagas%2Fcode-syntax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstagas%2Fcode-syntax/lists"}