### Bug description

Still looking for a good solution to https://github.com/quarto-dev/quarto-cli/issues/135, I found https://github.com/minrk/allthekernels which seems like a great candidate: it's a simple Jupyter kernel that forwards code cells to different sub-kernels for different languages (this also seems to be the approach favored by the Jupyter developers, see https://github.com/jupyterlab/jupyterlab/issues/2815).

However I found some issues trying to use it with Quarto. Here's my test document `a.qmd`:

    ---
    jupyter: atk
    ---
    
    ```{any}
    >python3
    import matplotlib.pyplot as plt
    plt.plot([1, 2, 3, 4])
    
    2+2
    ```
    
    ```{any}
    >octave
    plot(magic(2))
    
    2+2
    ```

First, two issues that should be fixed outside of Quarto I think:

* Calling `quarto render a.qmd` gives `ERROR: TypeError: Cannot read properties of undefined (reading 'toLowerCase')`. This is because the `kernel.json` doesn't define a language. The language key is [required](https://jupyter-client.readthedocs.io/en/stable/kernels.html#kernel-specs)  so this should probably be fixed in allthekernels. I fixed it by adding `"language": "any"` in the `kernel.json`.

* With the above fix, calling `quarto render a.qmd` sometimes produces an HTML file with code cells but empty outputs. It looks like a latency issue: it normally works the second time (once the daemon is running). The same issue can be observed when running the cells in Jupyter Notebook so it's probably a problem in allthekernels. 

Now the issue that should be fixed in Quarto I think: The execution requires that I mark code blocks with `{any}` to match the language declared in `kernel.json`. Due to this the code blocks are not formatted properly: no syntax highlighting and not even a gray background. What I would expect instead is to write

    ```{octave}
    >octave
    plot(magic(2))
    
    2+2
    ```

and have it work as long as I have defined `jupyter: atk`. If this worked I could also write a Lua filter to infer the `>octave` line from the block language and insert it automatically.

Note: the same issue affects the [SoS](https://vatlab.github.io/sos-docs/) kernel (another polyglot kernel that additionally enables data exchange between the sub-kernels).

Tested with quarto 1.2.269 and 1.3.26 on Pop!_OS 22.04.

### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
2022-11-25T17:37:41Z
knuesel
enhancement jupyter
Future
open
Code block language not working with "allthekernels" kernel
https://github.com/quarto-dev/quarto-cli/issues/3459