Skip to main content
3 of 6
[Edit removed during grace period]
Brock Adams
  • 13k
  • 5
  • 39
  • 64

There should be a StackExchange method you could hook into, but I don't see it. Also, post text can change for a few reasons. (The user finished an edit, or clicked on a snippet button, or clicked on one of those "This post has been edited" alerts, or triggered a spoiler, etc.)

To keep things simple and robust, I recommend just using an interval. EG:

var yourMarkupRegex = /\{\w{1,3}\}/;

//-- Poll for edits, irregardless of the cause:
setInterval ( function () { 
    var allPostText = $('.post-text').text ();
    if (yourMarkupRegex.test (allPostText) ) {
        // CALL YOUR PRETTIFIER FUNCTION HERE.
    }
}, 222);
Brock Adams
  • 13k
  • 5
  • 39
  • 64