Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Syntax-highlight a code string
ResourceFunction["SyntaxHighlight"][code,lang] gives the string for code with syntax highlighting corresponding to the language lang. |
Generate a syntax-highlighted version of a Python package:
In[1]:= | ![]() |
Out[1]= | ![]() |
Highlight a snippet of C code:
In[2]:= | ![]() |
Out[2]= | ![]() |
Highlight a snippet of Java code:
In[3]:= | ![]() |
Out[3]= | ![]() |
Highlight a snippet of code from a Wolfram Language package:
In[4]:= | ![]() |
Out[4]= | ![]() |
SyntaxHighlight fails if the Pygments Python package is not installed:
In[5]:= | ![]() |
Out[5]= | ![]() |
In[6]:= | ![]() |
Out[6]= | ![]() |
Run the same command after installing Pygments:
In[7]:= | ![]() |
Out[7]= | ![]() |
In[8]:= | ![]() |
Out[8]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License