-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving the text editor for live cells w/ CodeMirror #95
Comments
Thanks for the pointer; I had not seen Juniper on my radar. In ines/juniper#2, I asked about a potential Juniper/Thebelab convergence. |
I think a convergence would be great - my feeling w/ that project is that they liked thebelab's experience, wanted something slightly different for a specific use-case, and also wanted an excuse to learn a bit about the lab API, so perhaps they'd be open to working together a bit. It does seem like there's a lot of overlap |
I'm a little confused. thebelab also creates CodeMirror instances for cells with syntax highlighting, etc.. Is the issue about what CodeMirror options are enabled or not? |
oh interesting, I am confused as well then :-) For some reason when I launch thebelab I don't have any kind of syntax highlighting, so I assumed it wasn't using codemirror. Perhaps I am invoking it wrong? |
It could certainly be something wrong in thebelab not setting itself up right. Where is this happening? Do you see any errors in the js console? What's the highlight language? |
for an example see here: https://predictablynoisy.com/jupyter-book/features/notebooks (click the "thebelab" button) |
Could it be that you aren't adding a data-language attribute to your code cells? This was an issue I ran into when I was using Thebelab for the first time and swapping languages for testing. Based on the source code of that page, I would recommend adding code around line 169 of the notebooks.html file to correct this issue! // Find all code cells, replace with Thebelab interactive code cells
const codeCells = document.querySelectorAll('.input_area pre')
codeCells.forEach((codeCell, index) => {
const id = codeCellId(index)
codeCell.setAttribute('data-executable', '')
codeCell.setAttribute('data-language', 'python') //added line
}); |
This totally fixed my problem @Miniland1333 , thanks for letting me know :-) |
Should there be a word about that on Thebelab's homepage? |
A nice feature of the Juniper package is that it replaces code cells with
CodeMirror
cells that have syntax highlighting, themeing, etc. It seems that the code they use for creating codemirror cells is here:https://github.com/ines/juniper/blob/master/src/index.js#L135
Just flagging this in case it's in-scope and would be of value to thebelab
The text was updated successfully, but these errors were encountered: