Polyglot code blocks
See original GitHub issueI’m curious how one would go about writing a book in which the reader can choose a variant, say Python or Julia, for the code blocks. Could we teach MyST to process code-block variants, in which a single notebook contains multiple versions of code blocks, which we can execute separately with each kernel? So when building with a Python kernel, {code-block:julia}
would be ignored, and vice-versa. Then we build one or more variants and provide cross-references.
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (11 by maintainers)
Top Results From Across the Web
Polyglot extensible compiler framework
An open compiler front end framework for building Java language extensions ... Polyglot is a highly extensible compiler front end for the Java...
Read more >Polyglot Programming: Building Solutions by Composing ...
Polyglot programming refers to leveraging existing platforms by solving problems via solutions that compose special purpose languages.
Read more >Polyglot - Rosetta Code
A polyglot is a program that contains code in more than one language and produces the same output when it is compiled, assembled...
Read more >Polyglot Documentation with Org-mode - Oxford RSE
If there's a code block in an org-mode document, Babel can run the code, incorporating the results into the document or even using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Interesting project, though it seems to be about mixed-language workflows (where data needs to be passed between languages). I’m interested in the pedagogy, to maintain two versions of a book that use different programming languages. The use case that motivated me to open this issue is creating educational resources that did not lock instructors into a particular language choice (Python vs Julia). Most of the prose would be the same, but the code blocks and occasional admonitions would vary by language.
Gotcha, so similar to https://documentation.mailgun.com/en/latest/api_reference.html