2 of 3 added 1 character in body

# Retina, 52 bytes

This answer is based on my Perl answer, with the help of Martin Ender for the golfing with Retina.

^ *
[
$] \s+ , m):.+ [$&]
*T[]{}
], .
;
^.|]$ Try it online! The explanations can be found on my Perl answer. The differences are: * [$
]


Instead of s/^ *(.+)/[$1]/gm to both remove the leading spaces and add brackets around the lines. ^.|]$
`

To remove the leading and trailing brackets for the third output.