: Indesign and syntax highlighting I have a poster which I have made, it is basically lots of java code and looks like a wall of text. I want to add syntax highlighting to this so that the
I have a poster which I have made, it is basically lots of java code and looks like a wall of text.
I want to add syntax highlighting to this so that the code is more readable. I know that I can create styles and then apply them by selecting the text and adding the desired style, however there is so much code in the poster that I want t automate/batch this process.
Is there either a plugin I can use that will add the syntax highlighting or is there a way to add styles globally so that it adds the style to every instance of a certain character?
If anyone can think of a different way to achieve this using a different piece of software then please share :)
More posts by @Speyer780
1 Comments
Sorted by latest first Latest Oldest Best
This the kind of task where GREP Styles shine. Since you're setting javascript, I assume you're not unfamiliar with grep, but the GREP (for some reason, Adobe uses all caps) Styles dialog has plenty of help if you're rusty.
The first step is to create a set of colors you'll want to use to highlight different code elements, so they're ready in the Swatches panel.
The next step is to assign a Paragraph Style to all the code, if you haven't already. Once that's done, edit the Paragraph Style and go to the "GREP Style" section, where the magic starts.
Click on New GREP Style and in the Apply Style: dropdown select "New Character Style".
Give the style a name (I'm using "String" in this example), and assign a Character Color or font style such as bold, italic, etc. I'm using the stock green for the example.
In the To Text: section, enter the grep expression that will identify the text you want to target. In this case, it's pretty simple: ".+" finds any text between any pair of double quote marks.
That's the basic technique. From here you simply "rinse and repeat" until you've covered all the bases. Save the expressions for the next time you have one of these projects, because some of them will be quite lengthy.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.