IPython change input cell syntax highlighting logic for entire session

后端 未结 2 1470
無奈伤痛
無奈伤痛 2021-01-22 20:08

You can use extensions or display helpers in IPython to make whatever syntax highlighting you\'d like on output cells.

For some special cell magics, like

2条回答
  •  春和景丽
    2021-01-22 20:51

    For recent IPython version, the selected answer no longer works. The 'config_default' property was renamed options_default (Ipython 6.0.0). The following works:

    import IPython
    js = "IPython.CodeCell.options_default.highlight_modes['magic_fortran'] = {'reg':[/^%%fortran/]};"
    IPython.core.display.display_javascript(js, raw=True)
    

提交回复
热议问题