{"id":19423244,"url":"https://github.com/atomjoy/vue-highlightjs","last_synced_at":"2026-06-20T14:03:28.052Z","repository":{"id":232187174,"uuid":"783685983","full_name":"atomjoy/vue-highlightjs","owner":"atomjoy","description":"Vue3 higlightjs component with line numbers, toggle theme dark mode.","archived":false,"fork":false,"pushed_at":"2024-04-09T22:24:53.000Z","size":198,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T04:32:24.941Z","etag":null,"topics":["highlightjs","highlightjs-linenumbers","highlightjs-toggle-theme","highlightjs-vue","vue-highlight","vue-highlight-text","vue-highlighter","vue-highlightjs"],"latest_commit_sha":null,"homepage":"https://github.com/atomjoy/vue-highlightjs","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atomjoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-04-08T11:29:15.000Z","updated_at":"2024-04-09T22:26:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc06f6e7-0f86-41be-8af4-48efc41f0dbd","html_url":"https://github.com/atomjoy/vue-highlightjs","commit_stats":null,"previous_names":["atomjoy/vue-highlightjs"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/atomjoy/vue-highlightjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fvue-highlightjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fvue-highlightjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fvue-highlightjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fvue-highlightjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atomjoy","download_url":"https://codeload.github.com/atomjoy/vue-highlightjs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fvue-highlightjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34572426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"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":["highlightjs","highlightjs-linenumbers","highlightjs-toggle-theme","highlightjs-vue","vue-highlight","vue-highlight-text","vue-highlighter","vue-highlightjs"],"created_at":"2024-11-10T13:37:30.676Z","updated_at":"2026-06-20T14:03:28.035Z","avatar_url":"https://github.com/atomjoy.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-highlightjs\nVue3 highlightjs with line numbers.\n\n## Vue highlightjs component with toggle theme dark/light mode\n\n```vue\n\u003cscript setup\u003e\nimport CodeHighlight from '@/components/CodeHighlight/CodeHighlight.vue'\n\u003c/script\u003e\n\n\u003ctemplate\u003e\n\t\u003cCodeHighlight lang=\"php\" :code=\"code\" /\u003e\n\t\u003cCodeHighlight lang=\"php\" :code=\"code\" filename=\"App\\Models\\User.php\" /\u003e\n\t\u003cCodeHighlight lang=\"php\" :code=\"code\" theme=\"dark-theme\" filename=\"App\\Models\\User.php\" /\u003e\n\u003ctemplate\u003e\n```\n\n## Instalacja\n\n```sh\nnpm install\nnpm install @highlightjs/vue-plugin\n```\n\n## Laravel vue blade\n\n```blade\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"{{ str_replace('_', '-', app()-\u003egetLocale()) }}\" class=\"scrollbar-thin\"\u003e\n\u003chead\u003e\n\t\u003c!-- Highligt.js line numbers (delete if you dont need code line numbers) --\u003e\n\t\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js\"\u003e\u003c/script\u003e\n\t\u003cscript src=\"//cdn.jsdelivr.net/npm/highlightjs-line-numbers.js@2.8.0/dist/highlightjs-line-numbers.min.js\"\u003e\u003c/script\u003e\n\t\u003cscript type=\"text/javascript\"\u003e\t\t\n\t\twindow.onload = (event) =\u003e {\n\t\t\thljs.highlightAll();\n\t\t\thljs.initLineNumbersOnLoad({ startFrom: 1 });\n\t\t}\n\t\u003c/script\u003e\n\t\u003c!-- Highligt.js (delete if you dont need code line numbers) --\u003e\n\n\t@vite('resources/css/app.css')\n\u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv id=\"app\"\u003e\u003c/div\u003e\n    @vite('resources/js/app.js')  \n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Vue3 highlightjs component (mini)\n\n```vue\n\u003c!-- CodeHighlightMini.vue --\u003e\n\n\u003cscript setup\u003e\nimport 'highlight.js/styles/default.css'\nimport 'highlight.js/styles/github.min.css'\nimport hljs from 'highlight.js/lib/common';\nimport hljsVuePlugin from \"@highlightjs/vue-plugin\";\n\nconst props = defineProps({\n    code: { default: '\u003c?php echo \"Insert code here...\";' },\n    language: { type: String, default: 'php'}\n})\n\nconst highlightjs = hljsVuePlugin.component\n\nfunction debugCode(code, language = \"php\") {\n    hljs.getLanguage(language)\n    const result = hljs.highlight(props.code, { language: language });\n    console.log(result)\n}\n\u003c/script\u003e\n\n\u003ctemplate\u003e\n    \u003chighlightjs\n        :code=\"props.code\"\n        :language=\"props.language\"\n    /\u003e\n\u003c/template\u003e\n\n\u003cstyle\u003e\n@import url('./css/code.css');\n\u003c/style\u003e\n```\n\n## Use component in vue\n\n```vue\n\u003cscript setup\u003e\nimport CodeHighlightMini from '@/components/CodeHighlight/CodeHighlightMini.vue';\n\nconst code = `\u003c?php\n\nnamespace App\\\\Models;\n\n// use Illuminate\\\\Contracts\\\\Auth\\\\MustVerifyEmail;\nuse Illuminate\\\\Database\\\\Eloquent\\\\Factories\\\\HasFactory;\nuse Illuminate\\\\Foundation\\\\Auth\\\\User as Authenticatable;\nuse Illuminate\\\\Notifications\\\\Notifiable;\n\nclass User extends Authenticatable\n{\n    use HasFactory, Notifiable;\n\n    /**\n     * The attributes that are mass assignable.\n     *\n     * @var array\u003cint, string\u003e\n     */\n    protected $fillable = [\n        'name',\n        'email',\n        'password',\n    ];\n\n    /**\n     * The attributes that should be hidden for serialization.\n     *\n     * @var array\u003cint, string\u003e\n     */\n    protected $hidden = [\n        'password',\n        'remember_token',\n    ];\n\n    /**\n     * Get the attributes that should be cast.\n     *\n     * @return array\u003cstring, string\u003e\n     */\n    protected function casts(): array\n    {\n        return [\n            'email_verified_at' =\u003e 'datetime',\n            'password' =\u003e 'hashed',\n        ];\n    }\n}\n`\n\u003c/script\u003e\n\n\u003ctemplate\u003e    \n    \u003cdiv class=\"section\"\u003e\n        \u003cCodeHighlightMini lang=\"php\" :code=\"code\" /\u003e\n    \u003c/div\u003e\n\u003c/template\u003e\n```\n\n## Sample\n\n\u003cimg src=\"https://raw.githubusercontent.com/atomjoy/vue-highlightjs/main/highlightjs-vue.png\" width=\"100%\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomjoy%2Fvue-highlightjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatomjoy%2Fvue-highlightjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomjoy%2Fvue-highlightjs/lists"}