{"id":22970712,"url":"https://github.com/janole/embed-code","last_synced_at":"2025-08-01T02:10:09.872Z","repository":{"id":55662372,"uuid":"295233637","full_name":"janole/embed-code","owner":"janole","description":"A tiny component to render code with highlight.js inside of a terminal-like window.","archived":false,"fork":false,"pushed_at":"2020-12-14T15:38:40.000Z","size":324,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-08T10:16:02.211Z","etag":null,"topics":["code","javascript","javascript-library","npm"],"latest_commit_sha":null,"homepage":"","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/janole.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":"2020-09-13T20:39:17.000Z","updated_at":"2020-12-14T15:38:42.000Z","dependencies_parsed_at":"2022-08-15T05:50:47.020Z","dependency_job_id":null,"html_url":"https://github.com/janole/embed-code","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janole%2Fembed-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janole%2Fembed-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janole%2Fembed-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janole%2Fembed-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janole","download_url":"https://codeload.github.com/janole/embed-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246763952,"owners_count":20829800,"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":["code","javascript","javascript-library","npm"],"created_at":"2024-12-14T22:14:24.487Z","updated_at":"2025-04-02T06:15:17.039Z","avatar_url":"https://github.com/janole.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# embed-code\n\nA tiny component to render code with [highlight.js](https://highlightjs.org/) inside of a terminal-like window.\n\n![How to embed the code](doc/screenshot-1.png)\n\n## HOWTO\n\nThere are basically two ways of embedding the code. Both options will be using a simple JavaScript that is going to replace itself with the rendered code inside of a nice looking terminal window.\n\n### 1. Plain text inside of the script tag \n\n```html\n\u003cscript src=\"embed-code.js\" type=\"text/javascript\" data-lang=\"js\"\u003e\nfunction Welcome(props)\n{\n    return \u003ch1\u003eHello, {props.name}\u003c/h1\u003e;\n}\n\u003c/script\u003e\n```\n\n### 2. JSON encoded data inside of the script tag \n\n```html\n\u003cscript src=\"embed-code.js\" type=\"text/javascript\"\u003e\n{\"lang\": \"js\", \"code\": \"function Welcome(props)\\n{\\n    return \u003ch1\u003eHello, {props.name}\u003c\\/h1\u003e;\\n}\"}\n\u003c/script\u003e\n```\n\nThe result will be looking like this:\n\n![The embedded code](doc/screenshot-2.png)\n\n## CDN\n\nThe latest `embed-code.js` is available from unpkg.com:\n\n```diff\nhttps://unpkg.com/embed-code@latest/embed-code.js\n```\n\n## WHY\n\nI want to use this component in a Wordpress blog that's going to be filled from a github repository with markdown posts ...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanole%2Fembed-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanole%2Fembed-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanole%2Fembed-code/lists"}