A quick googling turned up a Eason’s Blog about doing just this.
His post links to another which is in Chinese but the code
snippets are all you need. Note that Eason’s post points out that
needs to be updated… something left out of the other.
(Also a note: leave a blank line above the
$$ starting a multi-line
block for best results.)
And now for a test
Looks pretty good.
I think Knuth would be pleased.