{"id":16999755,"url":"https://github.com/jbgruber/quarto-targetlang","last_synced_at":"2025-04-12T06:08:44.775Z","repository":{"id":242519093,"uuid":"809771349","full_name":"JBGruber/quarto-targetlang","owner":"JBGruber","description":"Quarto extension to split multilingual Quarto into language specific Jupyter notebooks","archived":false,"fork":false,"pushed_at":"2024-06-08T07:04:35.000Z","size":5,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T06:08:34.615Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/JBGruber.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":"2024-06-03T12:22:53.000Z","updated_at":"2024-07-29T16:32:33.000Z","dependencies_parsed_at":"2024-06-08T08:22:54.512Z","dependency_job_id":null,"html_url":"https://github.com/JBGruber/quarto-targetlang","commit_stats":null,"previous_names":["jbgruber/quarto-targetlang"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JBGruber%2Fquarto-targetlang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JBGruber%2Fquarto-targetlang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JBGruber%2Fquarto-targetlang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JBGruber%2Fquarto-targetlang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JBGruber","download_url":"https://codeload.github.com/JBGruber/quarto-targetlang/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525141,"owners_count":21118619,"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-10-14T04:10:04.689Z","updated_at":"2025-04-12T06:08:44.752Z","avatar_url":"https://github.com/JBGruber.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# Quarto split languages\n\n\n- [What this is for](#what-this-is-for)\n- [Using the language filter script](#using-the-language-filter-script)\n  - [Installing](#installing)\n  - [Usage](#usage)\n\n\u003c!-- README.md is generated from README.qmd. Please edit that file --\u003e\n\n## What this is for\n\nDeveloping notebooks on Google Colab sucks. However, when you need to\nteach a course in R or Python, Colab makes it a lot easier for the\nstudents to get started (and for the teachers who don’t have to run\naround cosplay an IT department). So I like to work in Quarto as long as\npossible and then use this addon to make 3 versions of my notebooks:\n\n1.  A Python version with just the Python code.\n2.  An R version with just the R code.\n3.  An HTML version with both.\n\nAs Colab supports only one language at a time, this seems to make most\nsense.\n\n## Using the language filter script\n\n### Installing\n\n``` bash\nquarto add jbgruber/quarto-targetlang\n```\n\nThis will install the extension under the `_extensions` subdirectory. If\nyou’re using version control, you will want to check in this directory.\n\n### Usage\n\nColab expects ipynb. This extension provides a special format which\ntakes the argument `target_lang` in the YAML header, and removes all\ncode chunks that do not fit this language:\n\n``` yaml\nformat:\n  targetlang-ipynb: \n    toc: false\n    filters: \n      - langsplit.lua\n  html: default\ntarget_lang: \"r\"\n```\n\nYou can render this from RStudio if you want. Or, what is even easier is\nto run it from the command line, using quarto-cli:\n\n``` bash\nquarto render template.qmd --no-execute --to targetlang-ipynb -o template-py.ipynb --metadata target_lang:python\nquarto render template.qmd --no-execute --to targetlang-ipynb -o template-r.ipynb --metadata target_lang:r\nquarto render template.qmd --to html\n```\n\nAlternatively, there is also a `quarto` R package:\n\n``` r\nlibrary(quarto)\nlibrary(quarto)\nquarto_render(input = \"template.qmd\", output_format = \"targetlang-ipynb\", output_file = \"template-py.ipynb\", execute = FALSE, metadata = list(target_lang = \"python\"))\nquarto_render(input = \"template.qmd\", output_format = \"targetlang-ipynb\", output_file = \"template-r.ipynb\", execute = FALSE, metadata = list(target_lang = \"r\"))\nquarto_render(input = \"template.qmd\", output_format = \"html\")\n```\n\n# Acknowledgment\n\nI'm not very good with lua and couldn't wrap my head around the pandoc extension immediately either.\nSo I'm grateful to the Stack Overflow users [tarleb](https://stackoverflow.com/users/2425163/tarleb) and [Shafee](https://stackoverflow.com/users/10858321/shafee) who wrote most of the lua code, to be honest.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbgruber%2Fquarto-targetlang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbgruber%2Fquarto-targetlang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbgruber%2Fquarto-targetlang/lists"}