Consider following command
Cases[ToBoxes[Block[{Identity}, Graph[{1 <-> 2, 2 <-> 3, 1 -> 3, 2 -> 1, 2 -> 3, 3 -> 1},
EdgeWeight -> Identity /@ {{0, 0}, {0, 0}, {1, 0}, {0, 1}, {1, 0}, {0, 1}}]]],
_GraphicsComplexBox, Infinity][[1, 2]]
with its output
{{Arrowheads[Medium],
Directive[Opacity[0.7], Hue[0.6, 0.7, 0.5]], {Arrowheads[0.],
ArrowBox[BezierCurveBox[{1, {0.606341, 0.514848}, 2}], 0.0127299]},
ArrowBox[BezierCurveBox[{1, {0.10576, 0.352183}, 3}], 0.0127299],
ArrowBox[BezierCurveBox[{2, {0.499413, 0.70158}, 3}],
0.0127299], {Arrowheads[0.],
ArrowBox[BezierCurveBox[{2, {0.500581, 1.03046}, 3}], 0.0127299]},
ArrowBox[BezierCurveBox[{2, {0.890575, 0.349397}, 1}], 0.0127299],
ArrowBox[BezierCurveBox[{3, {0.391162, 0.515612}, 1}],
0.0127299]}, {Directive[Hue[0.6, 0.2, 0.8],
EdgeForm[Directive[GrayLevel[0], Opacity[0.7]]]],
DiskBox[1, 0.0127299], DiskBox[2, 0.0127299],
DiskBox[3, 0.0127299]}}
I would like to reformat the output to something like
{
{
Arrowheads[Medium],
Directive[Opacity[0.7],
Hue[0.6, 0.7, 0.5]],
{
Arrowheads[0.],
ArrowBox[BezierCurveBox[{1, {0.606341, 0.514848}, 2}], 0.0127299]
},
ArrowBox[BezierCurveBox[{1, {0.10576, 0.352183}, 3}], 0.0127299],
ArrowBox[BezierCurveBox[{2, {0.499413, 0.70158}, 3}], 0.0127299],
{
Arrowheads[0.],
ArrowBox[BezierCurveBox[{2, {0.500581, 1.03046}, 3}], 0.0127299]
},
ArrowBox[BezierCurveBox[{2, {0.890575, 0.349397}, 1}], 0.0127299],
ArrowBox[BezierCurveBox[{3, {0.391162, 0.515612}, 1}], 0.0127299]
},
{
Directive[Hue[0.6, 0.2, 0.8],
EdgeForm[Directive[GrayLevel[0], Opacity[0.7]]]],
DiskBox[1, 0.0127299],
DiskBox[2, 0.0127299],
DiskBox[3, 0.0127299]
}
}
(ideally short lists are not broken)
Is there a way to do it in Mathematica or on the command line similar to GNU Indent or other available tools for languages like json, lisp, python list, etc. such as https://prettier.io ?
<<GeneralUtilities`; PrettyForm @ expr
or mathematica.stackexchange.com/q/2809/5478 $\endgroup$@
) $\endgroup$