I’ve seen multiple solutions to parse the document content before the insertion in the template,
see e.g.
Wordreplace and
PIP.
These solutions rely on a plugin. IMHO the backward effect is that all documents are affected by the plugin (which is not necessary the goal) and it is difficult to parametrize the change (perhaps with TVs).
Another solution I was thinking about is to use a snippet [[content]] (and remove [*content*] in the template). This snippet outputs the document’s with the desired changes. But in this cas we need a template for each type of change.
The solution (I think) : in the database we attach a php code or a snippet to documents.
When the documentObject is created, modx uses this code to modify $modx->documentObject[’content’]. The result may replace this element, or may be saved in $modx->documentObject[’content_parsed’].
We could create a new entity called content_parsers, besides snippets, chunks and templates...
We would attach a content_parser to a document in the same way we attach a template.
Maybe we could then use XSLT stylesheets for XML contents.