{"id":15658368,"url":"https://github.com/kcmr/code-sample","last_synced_at":"2025-09-13T08:08:11.508Z","repository":{"id":57125918,"uuid":"92110235","full_name":"kcmr/code-sample","owner":"kcmr","description":"A wrapper element for highlight.js","archived":false,"fork":false,"pushed_at":"2019-12-24T18:17:43.000Z","size":4031,"stargazers_count":22,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-31T03:07:27.643Z","etag":null,"topics":["code-highlight","highlighter","polymer-element","polymer2","web-component"],"latest_commit_sha":null,"homepage":"https://kcmr.github.io/code-sample/","language":"JavaScript","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/kcmr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-23T00:04:54.000Z","updated_at":"2023-05-05T23:09:02.000Z","dependencies_parsed_at":"2022-08-31T17:02:27.276Z","dependency_job_id":null,"html_url":"https://github.com/kcmr/code-sample","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/kcmr/code-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcmr%2Fcode-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcmr%2Fcode-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcmr%2Fcode-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcmr%2Fcode-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kcmr","download_url":"https://codeload.github.com/kcmr/code-sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcmr%2Fcode-sample/sbom","scorecard":{"id":552931,"data":{"date":"2025-08-11","repo":{"name":"github.com/kcmr/code-sample","commit":"fc08a00c5f4c00997301f9630a4fdcf08aa331e0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"152 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-42xw-2xvc-qx8m","Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-pp7h-53gx-mx7r","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-rq8g-5pc5-wrhr","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-wm7h-9275-46v2","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-r7jx-5m6m-cpg9","Warn: Project is vulnerable to: GHSA-j4f2-536g-r55m","Warn: Project is vulnerable to: GHSA-r7qp-cfhv-p84w","Warn: Project is vulnerable to: GHSA-3gx7-xhv7-5mx3","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-pfq8-rq6v-vf5m","Warn: Project is vulnerable to: GHSA-6x33-pw7p-hmpq","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-8g7p-74h8-hg48","Warn: Project is vulnerable to: GHSA-pc5p-h8pf-mvwp","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-7h8x-wmq2-7mff","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9","Warn: Project is vulnerable to: GHSA-pc58-wgmc-hfjr","Warn: Project is vulnerable to: GHSA-vvv8-xw5f-3f88","Warn: Project is vulnerable to: GHSA-3fx5-fwvr-xrjg","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-44fp-w29j-9vj5","Warn: Project is vulnerable to: GHSA-cwx2-736x-mf6w","Warn: Project is vulnerable to: GHSA-v39p-96qg-c8rf","Warn: Project is vulnerable to: GHSA-8v63-cqqc-6r2c","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-6fx8-h7jm-663j","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-pgcr-7wm4-mcv6","Warn: Project is vulnerable to: GHSA-4cpg-3vgw-4877","Warn: Project is vulnerable to: GHSA-566m-qj78-rww5","Warn: Project is vulnerable to: GHSA-hwj9-h5mp-3pm3","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-x3m3-4wpv-5vgc","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-fxwf-4rqh-v8g3","Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj","Warn: Project is vulnerable to: GHSA-xfhh-g9f5-x4m4","Warn: Project is vulnerable to: GHSA-qm95-pgcg-qqfq","Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-29xr-v42j-r956","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq","Warn: Project is vulnerable to: GHSA-v2p6-4mp7-3r9v","Warn: Project is vulnerable to: GHSA-3329-pjwv-fjpg","Warn: Project is vulnerable to: GHSA-p6j9-7xhc-rhwp","Warn: Project is vulnerable to: GHSA-89gv-h8wf-cg8r","Warn: Project is vulnerable to: GHSA-gcv8-gh4r-25x6","Warn: Project is vulnerable to: GHSA-gmv4-r438-p67f","Warn: Project is vulnerable to: GHSA-8h2f-7jc4-7m3m","Warn: Project is vulnerable to: GHSA-3vjf-82ff-p4r3","Warn: Project is vulnerable to: GHSA-g694-m8vq-gv9h","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv","Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q","Warn: Project is vulnerable to: GHSA-crh6-fp67-6883","Warn: Project is vulnerable to: GHSA-72mh-269x-7mh5","Warn: Project is vulnerable to: GHSA-h4j5-c7cj-74xg","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T11:25:11.455Z","repository_id":57125918,"created_at":"2025-08-20T11:25:11.455Z","updated_at":"2025-08-20T11:25:11.455Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274935979,"owners_count":25376836,"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-09-13T02:00:10.085Z","response_time":70,"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":["code-highlight","highlighter","polymer-element","polymer2","web-component"],"created_at":"2024-10-03T13:12:11.938Z","updated_at":"2025-09-13T08:08:11.447Z","avatar_url":"https://github.com/kcmr.png","language":"JavaScript","readme":"# \u0026lt;code-sample\u0026gt;\n[![Build Status](https://img.shields.io/travis/kcmr/code-sample/master.svg?style=flat-square)](https://travis-ci.org/kcmr/code-sample) \n[![codecov](https://codecov.io/gh/kcmr/code-sample/branch/master/graph/badge.svg)](https://codecov.io/gh/kcmr/code-sample)\n[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg?style=flat-square)](https://www.webcomponents.org/element/@kuscamara/code-sample)\n[![npm version](https://badge.fury.io/js/%40kuscamara%2Fcode-sample.svg)](https://badge.fury.io/js/%40kuscamara%2Fcode-sample)\n![Polymer 3](https://img.shields.io/badge/Polymer-3-green.svg)\n\n\u003e A wrapper element for [highlight.js](https://highlightjs.org/)\n\nA themeable sample code snippet that uses [highlight.js](https://highlightjs.org/) for syntax highlighting.   \nForget to worry about spaces, indentation, HTML entities, etc.\n\n```html\n\u003ccode-sample\u003e\n  \u003ctemplate\u003e\n    \u003cdiv class=\"some-class\"\u003e\n      \u003cp\u003eLorem ipsum dolor…\u003c/p\u003e\n    \u003c/div\u003e\n  \u003c/template\u003e\n\u003c/code-sample\u003e\n```\n\n## Installation\n\n1. Install the component using Npm:\n  ```bash\n  $ npm i -S @kuscamara/code-sample\n  ```\n2. Import Web Components loader (optional):\n  ```html\n  \u003cscript src=\"node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js\"\u003e\u003c/script\u003e\n  ```\n3. Import the component:\n  ```html\n  \u003cscript type=\"module\" src=\"node_modules/@kuscamara/code-sample/code-sample.js\"\u003e\u003c/script\u003e\n  ```\n\n## Usage\n\nThe code to highlight must be provided inside a `\u003ctemplate\u003e` tag.\n\n```html\n\u003ccode-sample\u003e\n  \u003ctemplate\u003e\n    \u003cp\u003eyour code here...\u003c/p\u003e\n  \u003c/template\u003e\n\u003c/code-sample\u003e\n```\n\n### Used inside a custom element\n\nWhen **used inside a custom element** you'll need to add the attribute `preserve-content` to the inner template to prevent Polymer to process the template's content.\n\n```html\n\u003ccode-sample\u003e\n  \u003ctemplate preserve-content\u003e\n    \u003cp\u003eyour code here...\u003c/p\u003e\n  \u003c/template\u003e\n\u003c/code-sample\u003e\n```\n\n### Used inside a tagged template literal\n\nWhen **used inside a tagged template literal** (Polymer or LitElement html function), you should escape any template string (`${expression}`) to prevent it from being evaluated getting an error.\n\n```js\nclass SomeElement extends PolymerElement {\n  static get template() {\n    return html`\n      \u003ccode-sample type=\"js\"\u003e\n        \u003ctemplate preserve-content\u003e\n          export class Example extends ExampleBase {\n            static get template() {\n              return html\\`\n                \u003cp\u003e\\${super.template}\u003c/p\u003e\n              \\`;\n            }\n          }\n        \u003c/template\u003e\n      \u003c/code-sample\u003e\n    `;\n  }\n}\n```\n\n### Render the code inside the template\n\nTo render the code inside the template, use the boolean attribute `render`.\n\n```html\n\u003ccode-sample render\u003e\n  \u003ctemplate\u003e\n    \u003cmy-custom-element\u003e\u003c/my-custom-element\u003e\n  \u003c/template\u003e\n\u003c/code-sample\u003e\n```\n\n### Copy to clipboard\n\nTo display a **copy to clipboard** button, use the boolean attribute `copy-clipboard-button`:\n\n```html\n\u003ccode-sample copy-clipboard-button\u003e\n  \u003ctemplate\u003e\n    \u003cp\u003eyour code here...\u003c/p\u003e\n  \u003c/template\u003e\n\u003c/code-sample\u003e\n```\n\n### Language types\n\nThe `type` attribute specifies the language of the sample code (eg.: html, css, js) and is not needed most of the time because it's automatically set. You can use it when your code sample language is not properly detected.\n\n```html\n\u003ccode-sample type=\"css\"\u003e\n  \u003ctemplate\u003e\n    .some-class {\n      @apply --my-mixin;\n    }\n  \u003c/template\u003e\n\u003c/code-sample\u003e\n```\n\n**Exception**: for the case of **tagged template literals**, you may need to set the `type` attribute to **js**, **jsx** or **javascript** to prevent the code being formatted as HTML.\n\n```html\n\u003ccode-sample type=\"js\"\u003e\n  \u003ctemplate\u003e\n    class MyElement extends PolymerElement {\n      static get template() {\n        return html`\n          \u003cstyle\u003e\n            :host {\n              display: block;\n            }\n          \u003c/style\u003e\n          \u003cp\u003eHello world!\u003c/p\u003e\n        `;\n      }\n    }\n  \u003c/template\u003e\n\u003c/code-sample\u003e\n```\n\n## Themes\n\nThe component includes 8 themes. One Dark is imported as the default theme.\nTo use another theme, import it and set as the `theme` property.\n\nExample:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { oneLight } from '../node_modules/@kuscamara/code-sample/themes/one-light.js';\n  document.querySelector('code-sample').theme = oneLight;\n\u003c/script\u003e\n```\n\n### Available themes\n\n- one-ligth.js as `oneLight`\n- default.js as `defaultTheme`\n- github.js as `github`\n- one-dark.js as `oneDark`\n- solarized-dark.js as `solarizedDark`\n- solarized-light.js as `solarizedLight`\n- kustom-light.js as `kustomLight`\n- kustom-dark.js as `kustomDark`\n\n### More themes\n\nYou can use your own theme by adding one of the [available themes](https://github.com/isagalaev/highlight.js/tree/master/src/styles) for hightlight.js in a shared style.\nThe shared style should be exported as a tagged template literal.\n\nExample:\n\n```js\nimport { html } from '@polymer/polymer/polymer-element.js';\n\nexport const myOwnTheme = html`\n\u003cstyle\u003e\n/* your own styles */\n\u003c/style\u003e`;\n```\n\n### Themes in browsers using ShadyCSS\nDue to **[ShadyCSS limitations](https://github.com/webcomponents/shadycss#dynamically-created-styles-are-not-supported)**, dynamic change of themes is **not supported in browsers that use ShadyCSS (Firefox)**. To set a different theme for these browsers, you should import your theme as a style module with `code-sample-theme` as its `id`. \n\n**Example:**\n\nIn `your-shared-style-file.js`:\n```js\nconst html = (string) =\u003e string;\nconst $documentContainer = document.createElement('div');\n$documentContainer.setAttribute('style', 'display: none;');\n\n$documentContainer.innerHTML = html`\n\u003cdom-module id=\"code-sample-theme\"\u003e\n  \u003ctemplate\u003e\n    \u003cstyle\u003e\n    /* your custom styles */\n    \u003c/style\u003e\n  \u003c/template\u003e\n\u003c/dom-module\u003e`;\n\ndocument.head.appendChild($documentContainer);\n```\n\nImport the shared style in the main document:\n```html\n\u003chead\u003e\n  \u003cscript type=\"module\" src=\"your-shared-style-file.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n```\n\nThe styles will be applied to `\u003ccode-sample\u003e` in browsers using ShadyCSS.\n\n### Languages included in the highlightjs pack included with the component:\n\n- CSS\n- HTTP\n- JavaScript\n- Bash\n- CoffeScript\n- JSON\n- Markdown\n- HTML, XML\n\nhighlightjs version: v9.12.0\n\n### Styling\n\nThe following custom CSS properties are available for styling:\n\n| Custom Property | Description | Default |\n| :-------------- | :---------- | :------ |\n| --code-sample-pre | empty mixin applied to `\u003cpre\u003e` element | {} |\n| --code-sample-font-family | font-family applied to `\u003cpre\u003e` and `\u003ccode\u003e` elements | Operator Mono, Inconsolata, Roboto Mono, monaco, consolas, monospace |\n| --code-sample-font-size | font-size applied to `\u003cpre\u003e` and `\u003ccode\u003e` elements | 14px |\n| --code-sample-line-height | line-height applied to `.hljs` | 1.3 |\n| --code-sample-hljs | empty mixin applied to `.hljs` | {} |\n| --code-sample-demo-padding | padding applied to the container of the rendered code | 0 0 20px |\n| --code-sample-demo-not-empty | empty mixin applied to the demo container when is not empty | {} |\n| --code-sample-demo | empty mixin applied to the container of the rendered code | {} |\n| --code-sample-code-container | empty mixin applied to code container | {} |\n| --code-sample-code-container-hover | empty mixin applied to code container on :hover | {} |\n| --code-sample-code-container-hover-button | empty mixin applied to the copy to clipboard button when the code container on :hover | {} |\n| --code-sample-copy-button-bg-color | background-color of the copy to clipboard button | #e0e0e0 |\n| --code-sample-copy-clipboard-button | empty mixin applied to the copy to clipboard button | {} |\n\nIncluded themes contain custom CSS properties to set the background and text color.   \nYou may need to add these CSS properties to your own themes.\n\n| Custom property                | Description                             | Default     |\n|:-------------------------------|:----------------------------------------|:------------|\n| --code-sample-background       | code background color                   | Depends on the theme         |\n| --code-sample-color            | code text color                         | Depends on the theme         |\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcmr%2Fcode-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkcmr%2Fcode-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcmr%2Fcode-sample/lists"}