0

I think I'm approaching this from the wrong direction, so am happy to adapt my workflow, but this is what I'm currently doing: I'm importing XML, which looks like this, into InDesign:

<Story>
  <h1>Heading</h1>
  <body>
    <p>An awesome paragraph.</p>
    <p>An even more awesome paragraph.</p>
  </body>
  <coloredblock>
    <h1>Heading for a colored block</h1>
    <body>
      <p>Paragraph of a colored block.</p>
      <p>Another paragraph.</p>
    </body>
  </coloredblock>
</Story>

I want <coloredblock> to stay within the text flow (I'm importing all this XML into the document's text frame), but to have a background color, and ideally have some inner padding - essentially, to look like the code block above in comparison with this body text.

Is this achievable? Do I need to make it as a separate text frame? If so, is there a way to make the <coloredblock> XML import as a separate text frame?

2 Answers 2

0

If you have InDesign CC 2015, you can simply call paragraph shading options in the paragraph style settings. It will let you set the background and the indents can be used for inner margins.

Otherwise, you cannot create frames on the fly with XML Import. What you can do then depends on your layout. Id the content is stable and will always be structure the same way, you can tag a frame so it receives the data at the time of import. If the data can't be foreseen, then you would need afterwards actions like a script for example.

1
  • Getting CC 2015 turned out to be the easiest way to solve this problem, unfortunately! Oct 1, 2016 at 15:30
0

Indesign can have paragraph styles and character styles nested inside those paragraph styles.

Because of this you can create a character style that's got the background colour (that's what this is within InDesign), some padding and perhaps even a slightly bolder weight.

You can then assign this to a keyboard shortcut, so everytime you want to highlight some part of the XML you can do this with just a selection and then a quick tap of the keyboard shortcut.

// I assume you're making some documentation or tutorial content and will need to do this often to show parts of the code. Something like this:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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