Consider the following .md file
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
format_version: '0.8'
jupytext_version: 1.4.1+dev
kernelspec:
display_name: Coconut
language: coconut
{code-cell} coconut
range(10) |> map$(pow$(?, 2)) |> list
````
Changing the kernel to coconut works, as can be seen in the rendered image below.

But the syntax highlighting does not. Is it possible to somehow define a syntax file for different kernels?
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
Hey @dsevero interesting, first I've ever heard of coconut!
According to the documentation, you should just need to have coconut installed in your document build environment: https://coconut.readthedocs.io/en/latest/DOCS.html#pygments
Does this work for you?
Hi, @chrisjsewell. Thank you for the response.
Coconut is great!
Yes, I have coconut installed.
As a second experiment, If I open a jupyter-notebook with coconut kernel the syntax works fine in the cells, but not when the book is built.
Is there anything else I can share to help?
What I'd plan to do next is first test that it works as advertised for "general" sphinx builds, e.g. running sphinx-quickstart, then adding to index.rst:
... code-block:: coconut
range(10) |> map$(pow$(?, 2)) |> list
and see in if that builds correctly.
I'll get round to it some time soon, or feel free to try yourself ๐
or even quicker, you could also try adding this to your .md file and checking whether it highlights:
md
```{code-block} coconut
range(10) |> map$(pow$(?, 2)) |> list
```
@chrisjsewell I added the following two:
`
{code-cell} coconut
range(10) |> map$(pow$(?, 2)) |> list
match [head] + tail in [0, 1, 2, 3]:
print(head, tail)
```{code-block} coconut
range(10) |> map$(pow$(?, 2)) |> list
match [head] + tail in [0, 1, 2, 3]:
print(head, tail)
````
Which resulted in

Hence the code-block works, but not the code-cell.
On the first run, I was missing cPyparsing==2.4.5.0.1.1 so I had to install it with pip. Not sure this is important, but I thought I might report it.
ok great thanks, so it appears an issue with myst-nb propagating the kernel language to the code-cells. I've added it to my TODO list!
I think that I have a similar issue. I'm using a Haskell kernel and a Scala kernel, and both languages are highlighted using the PythonLexer in the code cells.
Yep I should be able to sort that this week ๐ค
Ok fixed in myst-nb #234, and there's now a page in the documentation running Coconut ๐ https://myst-nb.readthedocs.io/en/latest/examples/coconut-lang.html
Should get this into jupyter-book in the next few days.
This should be closed in v0.8.0 ๐, but feel free to re-open/open another issue if anything is outstanding: https://jupyterbook.org/reference/_changelog.html#v0-8-0-2020-09-01
Excellent!
Miguel Montes
On Tue, Sep 1, 2020 at 12:24 PM Chris Sewell notifications@github.com
wrote:
This should be closed in v0.8.0 ๐, but feel free to re-open/open another
issue if anything is outstanding:
https://jupyterbook.org/reference/_changelog.html#v0-8-0-2020-09-01โ
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/executablebooks/jupyter-book/issues/878#issuecomment-684935822,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABWDL6LQ3OUJ6Z556NDVMXDSDUGZ7ANCNFSM4QADB5KQ
.
Most helpful comment
Yep I should be able to sort that this week ๐ค