question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Polyglot code blocks

See original GitHub issue

I’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:open
  • Created 3 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
jedbrowncommented, Jul 7, 2020

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.

2reactions
akhmerovcommented, Sep 1, 2020
Read more comments on GitHub >

github_iconTop 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-code - PyPI
Write console logs in 'any' programming language.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found