rasc,
If you want to replace all h2 with h3 across your whole site, then I’d recommend making a Plugin.
The Search Highlighting plugin is a good example of a simple plugin that alters the html on it’s way out of MODx.
This line gets the document output:
$output = $modx->documentOutput; // get the parsed document
...
Then it manipulates $output, and writes it back to the output buffer:
...
$modx->documentOutput = $output;
I would use str_replace if possible instead of preg_replace. str_replace is faster while preg_replace is more flexible.
So your plugin code might look like this:
$output = $modx->documentOutput; // get the parsed document
$output = str_replace('h2>', 'h3>', $output);
$modx->documentOutput = $output;
Or perhaps it could be optimized like this, which might use less memory:
$modx->documentOutput = str_replace('h2>', 'h3>', $modx->documentOutput);
After you input the above code into your new plugin (you can name it anything you want, and remember the plugin code should not contain <?php and ?> at the top and bottom), you need to click on the System Events tab and check the "OnWebPagePrerender" event. This will make sure that your code is run at the right time. It will run on every page view across the whole site (except for pages that are cached).