Avoid trailing newlines in code blocks

Ensure that code blocks are rendered with only the newline characters
included in the example source code.
Set code block height based on content

Render code blocks with height that is content-driven and remove magic
constants that previously controlled the height.