On Oct 30 2017, at 11:38 am, Denis Akhiyarov <[email protected]> wrote: > What is best practice for writing non-executable code in other (non-Python) > languages with Jupyter Notebooks? > > For example when I use `%%writefile` magic to write Fortran code to external > file in IPython kernel, then code cell appears to have "broken" syntax > highlighting (assumed to be Python?). > > But if I convert the code cell to markdown cell and configure Fortran code > inside with "```Fortran```" block, then there is no easy to export this to > external file like with the first option. > > Has anyone resolved this one way or the other or maybe with completely > different approach?
It's relatively easy to write your own cell magics, and you can use a bit of javascript to apply whatever highlighting mode you want to that cell. We used this method in ihtml to make html, css, and js cells in an IPython notebook with the appropriate highlighting: https://github.com/thedataincubator/ihtml I won't claim this is the best solution, but it does seem to work. Robert -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/local-4f869b27-02bc%40mando. For more options, visit https://groups.google.com/d/optout.
