INDD to EPUB export: wrapping individual paragraph styles in outer element
I'm trying to export an InDesign file to EPUB. Throughout the document there are code blocks which are made up of a bunch of individual lines with the paragraph style "Code". So when I export to EPUB, it shows up in the XHTML like this:
<p class="Code">example line of code</p>
<p class="Code">example line 2 of code</p>
<p class="Code">you get the idea...</p>
But how can I change the structure of the InDesign document so that when I export to EPUB, it "wraps" all the code lines into an outer <pre> and <code> element, and removes the individual paragraph styles from each code line? Basically, I want the XHTML to look like this instead:
<pre>
<code>
example line of code
example line of code 2
you get the idea...
</code>
</pre>
I tried editing the XML in the "Structure" panel to do this, but those changes aren't coming through at all when I export to EPUB.
Is it possible to do this in InDesign? If not, how do people generally go about adding outer block elements to EPUBs exported from InDesign? Is it something that you have to do manually in an XHTML editor like Sigil?
Thanks so much for any guidance!
