{"id":15935908,"url":"https://github.com/9oelm/embed-github","last_synced_at":"2026-02-16T17:33:51.577Z","repository":{"id":249419850,"uuid":"831332389","full_name":"9oelM/embed-github","owner":"9oelM","description":"Embed any public github source code with iframe.","archived":false,"fork":false,"pushed_at":"2024-07-25T02:36:23.000Z","size":737,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T02:41:18.472Z","etag":null,"topics":["embed","embed-github-file","github","iframe","iframe-embeds"],"latest_commit_sha":null,"homepage":"https://embed-github.lazer1.xyz/?gh=https://github.com/9oelM/embed-github/blob/main/README.md","language":"Rust","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/9oelM.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":"2024-07-20T08:45:27.000Z","updated_at":"2025-03-18T04:29:01.000Z","dependencies_parsed_at":"2024-07-25T03:21:11.509Z","dependency_job_id":null,"html_url":"https://github.com/9oelM/embed-github","commit_stats":null,"previous_names":["9oelm/embed-github"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/9oelM/embed-github","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9oelM%2Fembed-github","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9oelM%2Fembed-github/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9oelM%2Fembed-github/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9oelM%2Fembed-github/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/9oelM","download_url":"https://codeload.github.com/9oelM/embed-github/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9oelM%2Fembed-github/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29513989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["embed","embed-github-file","github","iframe","iframe-embeds"],"created_at":"2024-10-07T04:02:43.964Z","updated_at":"2026-02-16T17:33:51.559Z","avatar_url":"https://github.com/9oelM.png","language":"Rust","readme":"# embed-github\n\n![iframe Screenshot](./iframe-screenshot.png)\n\n`embed-github` is a simple Cloudflare worker that fetches source code from any public Github repository, highlights the code in a HTML format and sends it back as a response.\n\nNote that `embed-github` is a SSR application where the worker renders all HTML beforehand before sending the response, so the client will only see the website with minimal overhead. Zero external stylesheets or scripts.\n\n## How to use\n\nThe safest and recommended way is to deploy your own `embed-github` to Cloudflare. Otherwise, you can use my own deployment of the worker at https://embed-github.lazer1.xyz. But the operational status of this worker is not always guaranteed because it will stay on the free plan.\n\nSo if you decide to deploy your own worker, that's great, because Cloudflare workers free plan offers 100K requests per day. It must be more than enough for an average user like most of us. Just sign up for Cloudflare, and `git clone` this repository, delete `routes` key at [`wrangler.toml`](./wrangler.toml), and run `npx wrangler deploy`. Then it should give you the URL at which this worker is deployed. Use that URL for your iframe.\n\nThis is how you would use it in your `iframe`:\n\n```html\n\u003ciframe\n  frameborder=\"0\"\n  style=\"width:100%; height:307px;\"\n  allow=\"clipboard-write\"\n  src=\"https://embed-github.lazer1.xyz?gh=https://github.com/graphcentral/notion/blob/70cd31090c324f36537c0f60160a4c22452f54e3/.eslintrc.js\u0026lines=L1-L20\"\n\u003e\u003c/iframe\u003e\n```\n\n### Available query parameters\n\n1. `gh`:\n   1. **[must be a GH permalink](https://docs.github.com/en/repositories/working-with-files/using-files/getting-permanent-links-to-files#press-y-to-permalink-to-a-file-in-a-specific-commit)**. Example: https://github.com/9oelM/embed-github/blob/18835668eb5495b7c5c6f0c893289b410e5f780f/README.md#L13-L13\n   1. can be a value from `encodeURIComponent`, like: `https%3A%2F%2Fgithub.com%2F9oelM%2Fembed-github%2Fblob%2F18835668eb5495b7c5c6f0c893289b410e5f780f%2FREADME.md%23L13-L14`\n2. `lines`:\n   1. if `gh` parameter is a raw URL, then it must be in the format of `lines=L{number}-L{number}`. Example: `lines=L1-L10`. This is for convenience; When you don't want to run `encodeURIComponent` on the URL, just copy and paste, and change `#L13-L14` to `\u0026lines=L13-L14`. Otherwise, `lines` parameter doesn't have to be specified at all. In this case, the entire file will be shown.\n   1. if `gh` parameter is a value returned by `encodeURIComponent`, then the range of lines must have been included already in the URL as a fragment. `lines` parameter should not be provided again.\n3. `theme`: changes the theme used for the code highlighting. See below for the list of available themes.\n4. `lang`: override highlighting language. See below for the list of available languages.\n\nExamples of valid requests:\n\n- https://embed-github.lazer1.xyz?gh=https://github.com/graphcentral/notion/blob/70cd31090c324f36537c0f60160a4c22452f54e3/.eslintrc.js\u0026lines=L1-L20\n- https://embed-github.lazer1.xyz?gh=https%3A%2F%2Fgithub.com%2Fgraphcentral%2Fnotion%2Fblob%2F70cd31090c324f36537c0f60160a4c22452f54e3%2F.eslintrc.js%23L1-L20\n- https://embed-github.lazer1.xyz?gh=https%3A%2F%2Fgithub.com%2Fgraphcentral%2Fnotion%2Fblob%2F70cd31090c324f36537c0f60160a4c22452f54e3%2F.eslintrc.js\n- https://embed-github.lazer1.xyz?gh=https://github.com/graphcentral/notion/blob/70cd31090c324f36537c0f60160a4c22452f54e3/.eslintrc.js\n- https://embed-github.lazer1.xyz?gh=https://github.com/graphcentral/notion/blob/70cd31090c324f36537c0f60160a4c22452f54e3/.eslintrc.js\u0026theme=Solarized%20(dark)\n- https://embed-github.lazer1.xyz?gh=https%3A%2F%2Fgithub.com%2Fgraphcentral%2Fnotion%2Fblob%2F70cd31090c324f36537c0f60160a4c22452f54e3%2F.eslintrc.js%23L1-L20\u0026theme=base16-mocha.dark\n\n## Using a theme\n\nUse the `theme` query parameter to change the theme, like: `https://myworker.url?theme=Solarized%20(dark)`. Here's the list of all available themes:\n\n```\n\"InspiredGitHub\"\n\"Solarized (dark)\"\n\"Solarized (light)\"\n\"base16-eighties.dark\"\n\"base16-mocha.dark\"\n\"base16-ocean.dark\"\n\"base16-ocean.light\"\n```\n\nThe list of available themes is directly dependent on the underlying library [`syntect`](https://github.com/trishume/syntect/)'s `ThemeSet::load_defaults()`. If you want to add your own theme, you need to start from there.\n\n## Using a language\n\nAny of the file extensions below can be used as a `lang` query parameter to override automatic file extension detection.\n\n```\n\"txt\"\n\"asa\"\n\"asp\"\n\"as\"\n\"applescript\", \"script editor\"\n\"bat\", \"cmd\"\n\"build\"\n\"cs\", \"csx\"\n\"cpp\", \"cc\", \"cp\", \"cxx\", \"c++\", \"C\", \"h\", \"hh\", \"hpp\", \"hxx\", \"h++\", \"inl\", \"ipp\"\n\"c\", \"h\"\n\"css\", \"css.erb\", \"css.liquid\"\n\"clj\"\n\"d\", \"di\"\n\"diff\", \"patch\"\n\"erl\", \"hrl\", \"Emakefile\", \"emakefile\"\n\"yaws\"\n\"go\"\n\"dot\", \"DOT\", \"gv\"\n\"groovy\", \"gvy\", \"gradle\"\n\"html\", \"htm\", \"shtml\", \"xhtml\", \"inc\", \"tmpl\", \"tpl\"\n\"hs\"\n\"lhs\"\n\"jsp\"\n\"java\", \"bsh\"\n\"properties\"\n\"json\", \"sublime-settings\", \"sublime-menu\", \"sublime-keymap\", \"sublime-mousemap\", \"sublime-theme\", \"sublime-build\", \"sublime-project\", \"sublime-completions\", \"sublime-commands\", \"sublime-macro\", \"sublime-color-scheme\"\n\"js\", \"htc\"\n\"bib\"\n\"tex\", \"ltx\"\n\"sty\", \"cls\"\n\"lisp\", \"cl\", \"clisp\", \"l\", \"mud\", \"el\", \"scm\", \"ss\", \"lsp\", \"fasl\"\n\"lua\"\n\"make\", \"GNUmakefile\", \"makefile\", \"Makefile\", \"OCamlMakefile\", \"mak\", \"mk\"\n\"md\", \"mdown\", \"markdown\", \"markdn\"\n\"matlab\"\n\"ml\", \"mli\"\n\"mll\"\n\"mly\"\n\"mm\", \"M\", \"h\"\n\"m\", \"h\"\n\"php\", \"php3\", \"php4\", \"php5\", \"php7\", \"phps\", \"phpt\", \"phtml\"\n\"pas\", \"p\", \"dpr\"\n\"pl\", \"pm\", \"pod\", \"t\", \"PL\"\n\"py\", \"py3\", \"pyw\", \"pyi\", \"pyx\", \"pyx.in\", \"pxd\", \"pxd.in\", \"pxi\", \"pxi.in\", \"rpy\", \"cpy\", \"SConstruct\", \"Sconstruct\", \"sconstruct\", \"SConscript\", \"gyp\", \"gypi\", \"Snakefile\", \"wscript\"\n\"R\", \"r\", \"s\", \"S\", \"Rprofile\"\n\"rd\"\n\"rails\", \"rhtml\", \"erb\", \"html.erb\"\n\"js.erb\"\n\"haml\", \"sass\"\n\"rxml\", \"builder\"\n\"erbsql\", \"sql.erb\"\n\"re\"\n\"rst\", \"rest\"\n\"rb\", \"Appfile\", \"Appraisals\", \"Berksfile\", \"Brewfile\", \"capfile\", \"cgi\", \"Cheffile\", \"config.ru\", \"Deliverfile\", \"Fastfile\", \"fcgi\", \"Gemfile\", \"gemspec\", \"Guardfile\", \"irbrc\", \"jbuilder\", \"podspec\", \"prawn\", \"rabl\", \"rake\", \"Rakefile\", \"Rantfile\", \"rbx\", \"rjs\", \"ruby.rail\", \"Scanfile\", \"simplecov\", \"Snapfile\", \"thor\", \"Thorfile\", \"Vagrantfile\"\n\"rs\"\n\"sql\", \"ddl\", \"dml\"\n\"scala\", \"sbt\"\n\"sh\", \"bash\", \"zsh\", \"fish\", \".bash_aliases\", \".bash_completions\", \".bash_functions\", \".bash_login\", \".bash_logout\", \".bash_profile\", \".bash_variables\", \".bashrc\", \".profile\", \".textmate_init\"\n\"adp\"\n\"tcl\"\n\"textile\"\n\"xml\", \"xsd\", \"xslt\", \"tld\", \"dtml\", \"rss\", \"opml\", \"svg\"\n\"yaml\", \"yml\", \"sublime-syntax\"\n```\n\n## Todos\n\n1. Adjustable font size \u0026 line height\n1. 500 error due to \"Error: Worker exceeded CPU time limit\". It seems that HTML code block generation takes a lot of CPU time and returns an error. [The free plan on CF workers offers CPU time of 10 ms](https://developers.cloudflare.com/workers/platform/limits/#worker-limits), which might not be a lot for this worker.\n1. Webpage like https://emgithub.com/ where users can preview their iframe\n\n## Contributing\n\nHave the latest version of Rust installed. The default toolchain is **nightly**.\n\nRun:\n\n```\nnpx wrangler -e dev dev\n```\n\nto start a local development environment. Access the worker at http://localhost:8787.\n\nJust fork the repo, make changes, and make a PR from your branch at your fork.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9oelm%2Fembed-github","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F9oelm%2Fembed-github","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9oelm%2Fembed-github/lists"}