{"id":19689095,"url":"https://github.com/elisiondesign/vue-code-highlight","last_synced_at":"2025-04-29T08:35:06.742Z","repository":{"id":32791298,"uuid":"121120827","full_name":"elisiondesign/vue-code-highlight","owner":"elisiondesign","description":"Beautiful code highlighter as Vue.js component.","archived":false,"fork":false,"pushed_at":"2023-03-01T15:25:18.000Z","size":2577,"stargazers_count":124,"open_issues_count":19,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-19T08:43:47.253Z","etag":null,"topics":["component","prismjs","syntax-highlighting","vue"],"latest_commit_sha":null,"homepage":"","language":"CSS","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/elisiondesign.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}},"created_at":"2018-02-11T12:23:55.000Z","updated_at":"2025-04-02T09:29:02.000Z","dependencies_parsed_at":"2024-06-18T13:52:43.513Z","dependency_job_id":"39c46b93-aa34-475e-8418-c171797b3cbd","html_url":"https://github.com/elisiondesign/vue-code-highlight","commit_stats":{"total_commits":88,"total_committers":10,"mean_commits":8.8,"dds":0.4204545454545454,"last_synced_commit":"53c3d3476cb7493a05941fa982717e1c9f17122c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elisiondesign%2Fvue-code-highlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elisiondesign%2Fvue-code-highlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elisiondesign%2Fvue-code-highlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elisiondesign%2Fvue-code-highlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elisiondesign","download_url":"https://codeload.github.com/elisiondesign/vue-code-highlight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251465261,"owners_count":21593852,"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":["component","prismjs","syntax-highlighting","vue"],"created_at":"2024-11-11T18:42:51.081Z","updated_at":"2025-04-29T08:35:06.032Z","avatar_url":"https://github.com/elisiondesign.png","language":"CSS","readme":"# vue-code-highlight\n\n\u003e Beautiful code syntax highlighting as Vue.js component.\n\n## Examples\nhttps://codesandbox.io/s/vue-code-highlight-example-63h5m\n![screenshot](/public/screenshot2.png)\n\n## Usage\n\n```\nnpm install vue-code-highlight --save\n```\n\nNow, you can use this module in two diferrent ways, as a component or as a directive.\n\n### Component\nIn any component:\n\n```js\n// You have to extract the component from the module\nimport { component as VueCodeHighlight } from 'vue-code-highlight';\n\ncomponents:{\n  VueCodeHighlight,\n  ...\n}\n```\n\n```html\n\u003cvue-code-highlight language=\"javascript\"\u003e\n  \u003cpre\u003e\n //Paste your code here\n \u003c/pre\u003e\n\u003c/vue-code-highlight\u003e\n```\n**Props**\n|Prop          |Description\n|:--------------|:------------------------------------------|\n| **language** | Pass language name you want to highlight. Options: https://prismjs.com/#supported-languages |\n\nYour content will be highlighted dynamically when it updates. \n\nThe `\u003cpre\u003e` tag is required to preserve newline characters (They're stripped by default in Vue).\n\nWindow styles are already present in a component mode, but you will need to select and include a theme to properly highlight your code. (See the themes section.)\n\n### Directive\nIn your main file:\n```js\nimport VueCodeHighlight from 'vue-code-highlight';\n\nVue.use(VueCodeHighlight) //registers the v-highlight directive\n\n```\nAnd then in any Vue component:\n\n```html\n\u003cdiv v-highlight \u003e\n ...\n\u003c/div\u003e\n```\nAll markup under the div element having the following structure will be syntax highlighted.\n\n```html\n\u003cpre class=\"language-javascript\"\u003e\n  \u003ccode\u003e\n    //your code goes here\n  \u003c/code\u003e\n\u003c/pre\u003e\n```\n\nTo give the highlighter a window look in a directive mode, also don't forget to include the `./node_modules/vue-code-highlight/themes/window.css` file somewhere in your app.\n\n## Themes\nIn order to visually higlight your code, you need to select a theme from `./node_modules/vue-code-highlight/themes/` and import it somewhere into your component/application. These are just regular prism themes, so feel free to improvise.\n\n![themes](/public/themes.png)\n\n## Other languages\n\nAny of the [supported languages](https://prismjs.com/index.html#supported-languages) in Prism may be used. To enable support\nfor them, you must import them explicitly as well as Prism's markup templating.\n\nFor example, to include PHP highlighting in your application:\n\n```jsx\nimport 'prism-es6/components/prism-markup-templating';\nimport 'prism-es6/components/prism-php';\n```\n","funding_links":[],"categories":["CSS"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felisiondesign%2Fvue-code-highlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felisiondesign%2Fvue-code-highlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felisiondesign%2Fvue-code-highlight/lists"}