The trick to getting code block to align with indentation level is to completely write it on the base level, and then insert it using f.ex. tabs to the proper indentation level. This needs to be done for the start marker, the actual code, and for the end marker.
Especially if you skip indenting the end marker of your code block, things looks wonky.
The example above, shows code block properly aligned from first through fourth level of indentation. Source mode to the left, reading view to the right.