{"id":20649257,"url":"https://github.com/repalash/example-code-previewer","last_synced_at":"2025-04-17T00:59:05.188Z","repository":{"id":167670602,"uuid":"643277718","full_name":"repalash/example-code-previewer","owner":"repalash","description":"Code previewer component for html with syntax highlighting, codepen, multiple file support. ","archived":false,"fork":false,"pushed_at":"2023-06-25T13:59:01.000Z","size":233,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T19:50:30.139Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://repalash.com/example-code-previewer/","language":"JavaScript","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/repalash.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":"2023-05-20T16:47:32.000Z","updated_at":"2024-12-28T12:05:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"bcd3b799-5184-48c5-9c9c-f654664f2dc1","html_url":"https://github.com/repalash/example-code-previewer","commit_stats":null,"previous_names":["repalash/example-code-previewer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repalash%2Fexample-code-previewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repalash%2Fexample-code-previewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repalash%2Fexample-code-previewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repalash%2Fexample-code-previewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/repalash","download_url":"https://codeload.github.com/repalash/example-code-previewer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249296029,"owners_count":21246239,"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":[],"created_at":"2024-11-16T17:13:24.812Z","updated_at":"2025-04-17T00:59:05.181Z","avatar_url":"https://github.com/repalash.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example Code Previewer\n\n[![NPM Package](https://img.shields.io/npm/v/example-code-previewer.svg)](https://www.npmjs.com/package/example-code-previewer)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n![Example code viewer](./examples/hero-image.jpg)\n\nA minimal code viewer for html with support for syntax highlighting, multiple files, codepen prefill.\n\nSource code on Github: [https://github.com/repalash/example-code-previewer/](https://github.com/repalash/example-code-previewer/)\n\n## Demo\n\nCheck out the [simple](https://repalash.github.io/example-code-previewer/examples/simple.html) and [complex](https://repalash.github.io/example-code-previewer/examples/threejs.html) (with [three.js](https://threejs.org)) live demos\n\n## Usage\n\nUse directly in the HTML file with a CDN link\n```html\n\u003cscript type=\"module\"\u003e\nimport {setupCodePreview} from 'https://cdn.jsdelivr.net/gh/repalash/example-code-previewer/dist/index.js'\n\nsetupCodePreview(\n    document.getElementById('container'),\n    ['./script.js', './script.ts'], // scripts\n    ['js', 'ts'],\n    ['https://github.com/repalash/example-code-previewer/tree/master/examples/script.js', 'https://github.com/repalash/example-code-previewer/tree/master/examples/script.ts'], // links (source/github/gitlab etc)\n    (c)=\u003e c + `\\n // Append some code here`,\n    { // for codepen\n        title: 'Example: ' + document.title,\n        css: document.getElementById('example-style').textContent,\n    },\n).then(actions=\u003e{\n    // close when the container is clicked\n    document.querySelector('#container').addEventListener('click', (e)=\u003e e.target.id==='container' \u0026\u0026 actions.close())\n})\n\u003c/script\u003e\n```\n\nor install from `npm` and import\n\n```bash\nnpm install example-code-previewer\n```\n```js\nimport {setupCodePreview} from 'example-code-previewer'\n```\n\n## Development\nBuild for development (Build and watch):\n```bash\nnpm run dev\n```\nTo serve the local build and examples, run\n```bash\nnpm run serve\n```\n\n\nBuild for production (Build):\n```bash\nnpm run build\n```\n\nGenerate a new version\n```bash\nnpm version\n```\n\n## License\nMIT\n\n## References\n\nSyntax highlighting with [Speed highlight JS](https://github.com/speed-highlight/core)\n\nGenerated with [rollup-library-starter](https://github.com/repalash/rollup-library-starter)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepalash%2Fexample-code-previewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frepalash%2Fexample-code-previewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepalash%2Fexample-code-previewer/lists"}