CodeFormatter is a package that provides functionality for formatting Wolfram Language code.
Needs["CodeFormatter`"]
CodeFormat["If[a,f/@b,g/@c]"]
Out[2]= If[a,
f /@ b
,
g /@ c
]
Formatting the Wolfram Language from WTC 2020: Watch Video (youtube)
CodeFormatter depends on CodeParser paclet.
CodeFormatter and its dependencies are included in Mathematica 12.2 and above.
For older versions, install CodeFormatter paclet and dependencies from the public paclet server:
PacletInstall["CodeParser"]
PacletInstall["CodeFormatter"]
Build and install the CodeFormatter paclet locally
After CodeFormatter is installed, it can be used.
Needs["CodeFormatter`"]
CodeFormat["If[a,f/@b,g/@c]"]
Out[2]= If[a,
f /@ b
,
g /@ c
]
The input to CodeFormat
may be a string, a File
, or a list of bytes.
Make sure that the paclets can be found on your system:
and try a basic example:
CodeFormat["If[a, b, c]"]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4