Fix unwanted behaviour when converting text inside a list to a heading tag and vice versa

This fixes the heading problem issued earlier in #5. Converting heading lines to lists also works now as intended.