In this case I think you're running afoul of Calibre's default conversion settings - if you're calling ebook-convert from the command line then you need to change all the defaults that could affect you with the appropriate argument.
Calibre defaults to inserting page breaks before all h1 and h2 tags, this is the xpath:
//*[name()='h1' or name()='h2']
I think if you just pass an empty argument that should fix it - I think it's --page-breaks-before='', but double-check the docs.
|