Dynamically Set the SyntaxHighlighter Container Size

This blog posting demonstrates a method to set the SyntaxHighlighter container size using JavaScript which can be useful for showing long blocks of code that you want the user to scroll through to see.

The container size can be set using CSS but it's not always practical to change for one-off adjustments. The example below adds an event loops that waits for SyntaxHighlighter to generate the formatted code. When the formatted code is generated its container height is set and the event loop is removed.