"indent [ str_String ] := Module [ { ind, indent, f } , ind = 0; indent [ i_ ] := \"\\n\" <> Nest [ \" \" <> ToString [ # ] &, \"\", i ] ; f [ c_ ] := ( indent [ ind ] <> c <> indent [ ++ind ] ) /; StringMatchQ [ \" [ ( { \", ___ ~~ c ~~ ___ ] ; f [ c_ ] := ( indent [ --ind ] <> c <> indent [ ind ] ) /; StringMatchQ [ \" ] ) } \", ___ ~~ c ~~ ___ ] ; f [ c_ ] := ( c <> indent [ ind ] ) /; StringMatchQ [ \"; , \", ___ ~~ c ~~ ___ ] ; f [ c_ ] := c; f / @ Characters @ str // StringJoin ] " "List [ List [ 6, 10, 6 ] , List [ 4, 0, 10 ] , List [ 8, 7, 5 ] ] "