Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline code syntax highlighting in Jupyter markdown?

It is possible to syntax highlight inline code in Jupyter? Maybe similar as asked here.

Currently, the following markdown

   Inline code `np.array`.
   vs.
   Code block:
   ```python
   np.array
   ```

yields

enter image description here

like image 467
Friedrich Avatar asked Feb 23 '26 22:02

Friedrich


1 Answers

I don't think it is possible; the jupyter markdown defines the triple quote followed by a language name as the "syntax highlighting markup".

It is not exactly what you want, but there are two ways to color text in a md cell:

Using LaTeX:

${\text{inline code :}}\color{red}{\text{ np.array}}{\text{ but no cigar}}$

Using HTML:

inline code: <span style="color:red">np.array</span> but no cigar.

which respectively render like this:

enter image description here

like image 195
Reblochon Masque Avatar answered Feb 25 '26 11:02

Reblochon Masque



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!