[BUG-FIX]: missing new line

Checking the last string printed can be deceiving since there might
still be characters in the buffer that are not yet printed. For this
reason we needed to create the method `endl` for the writer object. By
using the argument set to False, we can tell the writer to print a new
line character in case the last printed character was not a new line. A
few things were also fixed with comments and a possible issue with the
`pre` tag. Instead of checking if we are inside a `pre` tag we can now
know how many levels of it we have encountered. I am not sure if we can
nest `pre` tags, but if that is permitted then this fix should cover it.