{"id":13632171,"url":"https://github.com/rameshvarun/blog-cells","last_synced_at":"2025-05-15T15:06:56.322Z","repository":{"id":179345618,"uuid":"659059573","full_name":"rameshvarun/blog-cells","owner":"rameshvarun","description":"Add interactive code snippets to any blog or webpage.","archived":false,"fork":false,"pushed_at":"2024-10-10T07:42:08.000Z","size":2507,"stargazers_count":496,"open_issues_count":10,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-10T16:55:30.370Z","etag":null,"topics":["blogging","javascript","literate-programming","live-coding","notebooks","python","typescript"],"latest_commit_sha":null,"homepage":"https://rameshvarun.github.io/blog-cells/","language":"TypeScript","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/rameshvarun.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":"2023-06-27T04:10:05.000Z","updated_at":"2025-05-07T03:28:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9f8ff59-da86-4b39-b17c-08af455100e2","html_url":"https://github.com/rameshvarun/blog-cells","commit_stats":null,"previous_names":["rameshvarun/blog-cells"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameshvarun%2Fblog-cells","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameshvarun%2Fblog-cells/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameshvarun%2Fblog-cells/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameshvarun%2Fblog-cells/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rameshvarun","download_url":"https://codeload.github.com/rameshvarun/blog-cells/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254364270,"owners_count":22058878,"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":["blogging","javascript","literate-programming","live-coding","notebooks","python","typescript"],"created_at":"2024-08-01T22:02:54.533Z","updated_at":"2025-05-15T15:06:55.472Z","avatar_url":"https://github.com/rameshvarun.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# blog-cells\n[![Node.js CI](https://github.com/rameshvarun/blog-cells/actions/workflows/node.js.yml/badge.svg)](https://github.com/rameshvarun/blog-cells/actions/workflows/node.js.yml)\n[![npm](https://img.shields.io/npm/v/blog-cells)](https://www.npmjs.com/package/blog-cells)\n\n\u003ca href=\"https://rameshvarun.github.io/blog-cells/\"\u003e\n\u003cp align=\"center\"\u003e\u003cimg width=\"400px\" src=\"./screenshot.png\"\u003e\u003c/img\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e[VIEW DEMO]\u003c/p\u003e\n\u003c/a\u003e\n\nAdd interactive code cells to any webpage, similar to [Jupyter](https://jupyter.org/) or [ObservableHQ](https://observablehq.com/). Works with direct HTML editing, static site generators like Jekyll / Hugo, and more.\n\n## Usage\n\n### Quickstart\n\nJust drop in JS / CSS imports and start creating code cells using `\u003cscript type=\"text/notebook-cell\"\u003e` elements. \u003cb\u003eblog-cells\u003c/b\u003e will transform these script tags into interactive, runnable code snippets.\n\n```html\n\u003c!-- Import blog-cells JS and CSS files. --\u003e\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/blog-cells@0.7.1/dist/blog-cells.css\" integrity=\"sha384-WTyObMIz+pJFKKBrAWAzdQR97p6wSVxgp4MrCmb2kxgAqz5M8sPvKBINcDpp1ERV\" crossorigin=\"anonymous\"\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/blog-cells@0.7.1/dist/blog-cells.js\" integrity=\"sha384-8IdgH/vqj5QT2hghXrEdBvZwtNAK82dxP4JdkptO3xpqDeOFij/7sR2rqwQlHXPt\" crossorigin=\"anonymous\"\u003e\u003c/script\u003e\n\n\u003c!-- Create your code cells in script tags --\u003e\n\u003cscript type=\"text/notebook-cell\"\u003e\nconsole.log(\"Hello World!\");\n\u003c/script\u003e\n```\n\nTry it on [CodePen](https://codepen.io/varunramesh/pen/WNYVNQQ) or [JSFiddle](https://jsfiddle.net/varunramesh/o217xpc5/latest/).\n\n### Other Languages\n\nIn addition to JavaScript, you can also embed code in other languages by adding a `data-kernel` attribute.\n\n```html\n\u003cscript type=\"text/notebook-cell\" data-kernel=\"python\"\u003e\nprint(\"Hello World!\")\n\u003c/script\u003e\n```\n\nThe following kernel values are currently supported:\n- `javascript` (Default)\n- `python`\n\n### Cell Attributes\n\nCells can be configured with the following attributes:\n\n- `data-autorun=\"true\"` - Automatically run a cell on page load. Autorun cells are run in the order that they appear on the page.\n- `data-hidden=\"true\"` - Make a cell hidden by default - readers can toggle the cell's visibility.\n\n### Using `\u003cpre\u003e` tags instead of `\u003cscript\u003e` tags\n\nScript tags are great for defining notebook cells since they can hold pretty much any code without escaping. However, you can also use `\u003cpre class=\"notebook-cell\"\u003e` tags instead. When using `pre` tags, reserved HTML characters should be escaped using HTML entities (this can be done by your static site generator).\n\n```html\n\u003cpre class=\"notebook-cell\"\u003e\nconsole.log(\"\u0026lt;b\u0026gt;HELLO\u0026lt;/b\u0026gt;\");\n\u003c/pre\u003e\n```\n\n### Creating a Custom Kernel\n\nYou can easily define and use your own custom kernels.\n\n```html\n\u003c!-- Import blog-cells JS and CSS files. --\u003e\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/blog-cells@0.7.1/dist/blog-cells.css\" integrity=\"sha384-WTyObMIz+pJFKKBrAWAzdQR97p6wSVxgp4MrCmb2kxgAqz5M8sPvKBINcDpp1ERV\" crossorigin=\"anonymous\"\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/blog-cells@0.7.1/dist/blog-cells.js\" integrity=\"sha384-8IdgH/vqj5QT2hghXrEdBvZwtNAK82dxP4JdkptO3xpqDeOFij/7sR2rqwQlHXPt\" crossorigin=\"anonymous\"\u003e\u003c/script\u003e\n\n\u003c!-- Define custom kernel --\u003e\n\u003cscript\u003e\nclass JSONFormatKernel extends BlogCells.Kernel {\n  async run(code, onOutput) {\n    const data = JSON.parse(code.trim());\n    onOutput({ type: \"log\", line: JSON.stringify(data, undefined, 2) });\n  }\n}\nBlogCells.registerKernel(\"json-format\", () =\u003e new JSONFormatKernel());\n\u003c/script\u003e\n  \n\u003c!-- Use custom Kernel --\u003e\n\u003cscript type=\"text/notebook-cell\" data-kernel=\"json-format\"\u003e\n[4, {\"hello\": 3}]\n\u003c/script\u003e\n```\n\n## Developing\n\n```bash\ngit clone https://github.com/rameshvarun/blog-cells.git\ncd blog-cells\nnpm install\nnpm start\n```\n\n## Attributions\n\nThis repo contains assets from other open source projects.\n\n- [https://github.com/SamHerbert/SVG-Loaders](https://github.com/SamHerbert/SVG-Loaders) (MIT)\n\n## Alternatives\n- https://starboard.gg/\n- https://observablehq.com/\n- https://jupyter.org/try-jupyter/lab/\n- https://www.typecell.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frameshvarun%2Fblog-cells","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frameshvarun%2Fblog-cells","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frameshvarun%2Fblog-cells/lists"}