1

I am using Indesign CC to create a book on HTML programming. I have used TextFrames to add blocks of code and markup. When I generate an ePub out of it, the code blocks and markup are generated without indentation. Everything is left aligned.

However when I export the textframe as an image, the markup comes with indentation but the file size is way too big and the code is obviously not selectable.

What options do I have here? Here's an example of the kind of code I am dealing with:

<body>
    <table border="1">
        <thead>
            <tr>
                <th class="c1">ABC</th>
                <th class="c2">PQR</th>
                <th class="c3">XYZ</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>1</td>
                <td>Book</td>
                <td>Top</td>
            </tr>
  • 2
    The real problem is that ePub is basically HTML, so your code needs to be wrapped in a PRE element in order to maintain your desired spacing and indentation (unless converted to an image). I have zero knowledge of InDesign, and have no way of knowing whether or not there is an option to set blocks of text as preformatted on export, but that's what you need. – Stan Rogers Nov 21 '14 at 14:14
  • @StanRogers Great tip. I am trying to use some css to wrap my div's in a <pre> tag. Let's see hwo it goes – Hitz Nov 21 '14 at 18:10
2

You need to apply a paragraph style in InDesign. They are not in Window but the panel is located in Type. Shortcut cmd+F11:

enter image description here

Create the paragraph style, double click, go to Indents and Spacing:

enter image description here

Add your desired indent in the First Line Indent:

enter image description here

enter image description here


Taking it a little further. You could unpack the ePub and navigate to your CSS and build a class and apply text-indent. If you do go this route be careful because the output of InDesign will produce multiple CSS classes so you will need to verify that your indention was applied correctly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.