The first argument of this function is a string or a list of strings (yet to parse) mixed with some already parsed objects. An example usage is the following
structuralReplace(
'**this** is **a** test',
/\*\*(.+?)\*\*/g,
m => ({ style: 'bold', text: m[1] })
)
and this produces an object of the following form
[
{ style: 'bold', text: 'this' },
'is',
{ style: 'bold', text: 'a' },
'test'
]