{"id":23150965,"url":"https://github.com/coatless-quarto/colab","last_synced_at":"2025-10-04T04:54:00.364Z","repository":{"id":265261495,"uuid":"814364025","full_name":"coatless-quarto/colab","owner":"coatless-quarto","description":"[Developmental] Quarto Extension to Enable Google Colaboratory Links with Quarto Documents ","archived":false,"fork":false,"pushed_at":"2024-11-30T10:00:22.000Z","size":21,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T00:39:00.881Z","etag":null,"topics":["colab","google-colab","lua","quarto","quarto-extension"],"latest_commit_sha":null,"homepage":"https://quarto.thecoatlessprofessor.com/colab/","language":"Lua","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/coatless-quarto.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},"funding":{"github":["coatless"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2024-06-12T21:40:38.000Z","updated_at":"2024-11-30T10:00:26.000Z","dependencies_parsed_at":"2024-11-28T21:02:00.156Z","dependency_job_id":null,"html_url":"https://github.com/coatless-quarto/colab","commit_stats":null,"previous_names":["coatless-quarto/colab"],"tags_count":0,"template":false,"template_full_name":"coatless-devcontainer/quarto-extension-dev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fcolab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fcolab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fcolab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fcolab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coatless-quarto","download_url":"https://codeload.github.com/coatless-quarto/colab/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247198431,"owners_count":20900079,"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":["colab","google-colab","lua","quarto","quarto-extension"],"created_at":"2024-12-17T18:19:38.259Z","updated_at":"2025-10-04T04:54:00.352Z","avatar_url":"https://github.com/coatless-quarto.png","language":"Lua","readme":"# quarto-colab: A Quarto Extension for Google Colaboratory \u003cimg src=\"docs/quarto-colab-logo.svg\" align=\"right\" alt=\"Logo: A notebook going into an abstract cloud\" width=\"150\"/\u003e\n\nThe `{quarto-colab}` extension enables Google Colab integration for your Quarto documents rendered to Juypter Notebook. It adds \"Open in Colab\" badges and handles the configuration of Jupyter magic commands for languages like R, SQL, and Octave, letting anyone run your notebooks in Colab with a single click.\n\n\u003e [!NOTE]\n\u003e\n\u003e This Quarto extension is open source software and is **not affiliated with** Google. The extension is at best a community effort to simplify the integration of Google's Colaboratory runtime inside of Quarto documents.\n\n## Installation\n\nAdd the extension to your Quarto project by running the following command in Terminal within your Quarto project directory:\n\n```bash\nquarto add coatless-quarto/colab\n```\n\nThis command will download and install the extension under the `_extensions` subdirectory of your Quarto project. If you're using version control, make sure to include this directory in your repository.\n\n### Requirements\n\n- Quarto \u003e= 1.4.0\n- `R` and `knitr` (for polyglot document evaluation)\n- GitHub public repository (for Colab to access your notebooks)\n- Google Colab account (for Colab features)\n\n## Usage\n\nWe recommend using this extension as part of a multi-format output using\n`jupyter` and `html` formats.\n\n### Basic Setup\n\nAdd the following to your document's header or `_quarto.yml`:\n\n```yaml\n---\ntitle: \"My Document\"\nformat:\n  jupyter: default\n  html: default\ncolab:\n  gh-user: \"username\"    # Your GitHub username\n  gh-repo: \"reponame\"    # Your repository name\n  gh-branch: \"main\"      # Optional, defaults to \"main\"\nfilters:\n  - colab\n---\n```\n\n### Scrolling to Specific Cells\n\nYou can configure the extension to automatically scroll to a specific cell when opening the notebook in Colab:\n\n```yaml\ncolab:\n  gh-user: \"username\"\n  gh-repo: \"reponame\"\n  gh-branch: \"main\"\n  scroll-to: \"sGO-VJ_Bb0tU\"   # Cell ID to scroll to\n```\n\nThis will create a Colab link that includes the scrollTo parameter, like:\n\n```default\nhttps://colab.research.google.com/github/username/reponame/blob/main/notebook.ipynb#scrollTo=sGO-VJ_Bb0tU\n```\n\n\u003e [!TIP]\n\u003e\n\u003e To find a cell's ID in Colab, right-click on a cell and select \"Copy Link to Cell\". \n\u003e The part after `scrollTo=` is the cell ID.\n\n\n### Language Configuration\n\n#### Magic Commands (Optional)\n\nDefine the cell magic commands for different languages to use in your document:\n\n```yaml\nmagic-commands:\n  r: \"%%R\"              # Custom R magic command\n  julia: \"%%julia\"      # Custom Julia magic command\n  newlang: \"%%newlang\"  # Custom magic command for a new language\n```\n\n#### Setup Cells (Optional)\n\nDefine custom environment setup for different languages:\n\n```yaml\nsetup-cells:\n  r:\n    language: \"python\"    # Language assumed for the setup cell\n    code: |\n      # Custom R setup\n      !pip install rpy2\n      %load_ext rpy2.ipython\n```\n\n### HTML Support (Work in Progress)\n\nWhile automatic HTML integration is under development, you can manually add Colab links to your HTML output:\n\n```yaml\nformat:\n  html:\n    code-links:\n      - text: \"Open in Colab\"\n        href: \"https://colab.research.google.com/github/USERNAME/REPO/blob/BRANCH/PATH_TO_NOTEBOOK.ipynb\"\n        icon: \"laptop\"\n```\n\nReplace `USERNAME`, `REPO`, `BRANCH`, and `PATH_TO_NOTEBOOK.ipynb` with your specific values.\n\n\u003e [!NOTE]\n\u003e \n\u003e We know this is a bit cumbersome and are working on a better solution.\n\n## Supported Languages\n\nThe extension includes pre-configured setup for:\n\n- R (using [`{rpy2}`][rpy2magic])\n- Julia (using [`{juliacall}`][juliacallmagic])\n- Octave (using [`{oct2py}`][oct2pymagic])\n- SQL (using [`{jupysql}`][jupysqlmagic])\n- SAS (using [`{saspy}`][saspymagic] + licensed copy and a way to access it)\n\nAdditional languages are supported via magic commands without requiring specific setup cells.\n\n- Ruby \n- Perl \n- bash/sh\n\nFor additional languages, you can define custom magic commands and setup cells in the document's header.\n\n## Acknowledgements\n\nThis extension is based on the [Using Google Colab with GitHub](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb#scrollTo=8QAWNjizy_3O) notebook.\n\n### Notes\n\nThis extension formed the basis of my [**second** ever issue ticket](https://github.com/quarto-dev/quarto-cli/issues?q=is%3Aissue%20author%3Acoatless%20sort%3Acreated-asc) on the Quarto project's GitHub issue tracker [quarto-dev/quarto-cli#1224](https://github.com/quarto-dev/quarto-cli/issues/1224). The issue ticket was opened on **October 1, 2022**. Wowie, how time flies when you're having fun!\n\n[rpy2magic]: https://rpy2.github.io/doc/v3.5.x/html/interactive.html#module-rpy2.ipython.rmagic\n[juliacallmagic]: https://juliapy.github.io/PythonCall.jl/stable/compat/#IPython \n[oct2pymagic]: https://nbviewer.org/github/blink1073/oct2py/blob/main/example/octavemagic_extension.ipynb?create=1\n[jupysqlmagic]: https://jupysql.ploomber.io/en/latest/api/magic-sql.html\n[saspymagic]: https://sassoftware.github.io/saspy/advanced-topics.html#jupyter-magics\n","funding_links":["https://github.com/sponsors/coatless"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-quarto%2Fcolab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoatless-quarto%2Fcolab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-quarto%2Fcolab/lists"}