title: modify epub file by python's ebooklib, but all the contents inside <head> was lost
body: <p>I'm using the <strong>python</strong> ebook library <strong>ebooklib</strong> to modify a batch of epub files.  The dummy code is as the following.</p>
  <pre><code>book = epub.read_epub(input_path)
  
  page_add = epub.EpubHtml(title='index_add', file_name='index_add.html', lang='en')
  page_add.content = u'''
  &lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&gt;
      &lt;body&gt;
          &lt;div&gt;
              I'm a new added page
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  '''
  book.add_item(page_add)
  
  book.spine.insert(1, page_add)
  
  epub.write_epub(output_path, book, {})
  </code></pre>
  <p>After running the code, a new epub file was generated, and the new page was added to it.  The issue is that all the <strong>original content of the original epub file lost their styles</strong>.</p>
  <p>As we know, the epub file is composed of HTML files.  I changed the file extension from <strong>.epub</strong> to <strong>.zip</strong>, and then <strong>unzip</strong> it, then I can get all the HTML files.  After digging into these files for a while, I found the reason of losing all the style is that all the stylesheet file was located inside the <code>&lt;head&gt;</code> tag of all the original HTML files, but the new file lost all of these content inside the <code>&lt;head&gt;</code> tag.  The original <code>&lt;head&gt;</code> looks like the following:</p>
  <pre><code>&lt;head&gt;
      &lt;link href=&quot;../stylesheet.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
      &lt;link href=&quot;../page_styles.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
  &lt;/head&gt;
  </code></pre>
  <p>From the <strong>ebooklib's</strong> <a href="https://readthedocs.org/projects/ebooklib/downloads/pdf/latest/" rel="nofollow noreferrer">doc</a>, I found the following description:</p>
  <blockquote>
  <p>When defining content you can define it as valid HTML file or just parts of HTML elements you have as a content. It will ignore whatever you have in <code>&lt;head&gt;</code> element.</p>
  </blockquote>
  <p>I think this may be the reason why all the content inside <code>&lt;head&gt;</code> tag was lost.  I don't know why <strong>ebooklib</strong> did this.  Does anyone have a way to fix it?  I think my requirement is quite common.  Just add a page into lots of existed epub files.</p>
  <p>Any help will be highly appreciated.</p>