Copy link to clipboard
Copied
Hi, is there a more efficient way to create and display code other than creating specific a Paragraph style? Members of my team are trying to differentiate (by highlighting) different blocks/part of code in a page. Styles have been problematic as people have been manually configuring the styles using the toolbar (instead of going into the actual style window for new configurations).
We want to use syntax highlighting for our code (using https://tohtml.com/java/​​) and then paste it into InDesign but need a formatting tool that will retain the code itself when pasting into InDesign.
Copy link to clipboard
Copied
I don't understand why styles should be problematic.
If I want to change a style, I change the properties and redefine the style.
If I need a new style just for that paragraph based on another style I make the changes in that paragraph, create a new style based on the other on. I make it clear n the naming. Let say the original style has the name p (I use paragraph style names as short as possible for several reasons) and the new style will have the name p.xy, so it is always clear, that if I do anything with p p.xy will be affected.
If your coworkers don't understand styles, you need to make a training.
Copy link to clipboard
Copied
https://forums.adobe.com/people/Willi+Adelberger wrote
I don't understand why styles should be problematic.
…
Hi Willi,
doing code syntax highlighting with e.g. GREP Styles is a complex task.
If someone can point me to a good source I'll be very glad.
Also tried this for the documentation of my scripts, but it never was perfect.
So Colin's suggestion is worth considering. Thanks, Colin!
Regards,
Uwe
Copy link to clipboard
Copied
I was able to copy and paste a sample of javascript that had the syntax highlighting applied via the website in the opening post. However, it was not a direct cut and paste into InDesign, but I clicked the copy to clipboard button on the website, went to Microsoft Word and pasted the text in, then highlighted and copied the newly placed text and then pasted into InDesign. A roundabout way of doing it but it worked.
This kind of formatting will need plenty of character styles though, not just paragraph styles. But if you want to take the text in as it first appeared on that website, then it is worth trying the above method first before assigning character and paragraph styles.
Copy link to clipboard
Copied
https://forums.adobe.com/people/Colin+Flashman wrote
I was able to copy and paste a sample of javascript that had the syntax highlighting applied via the website in the opening post. However, it was not a direct cut and paste into InDesign, but I clicked the copy to clipboard button on the website, went to Microsoft Word and pasted the text in, then highlighted and copied the newly placed text and then pasted into InDesign. A roundabout way of doing it but it worked.…
Hi Colin,
just tried that and it's working.
But there is also a problem with that:
How can I copy/paste formatted with language set to "No Language"?
My MS Word will always apply German to the text, characters like " and ' will change to the typographer quotation marks when pasted to InDesign. Is there a way in Word to format text with "No Language" ? I guess not, at least I see no way for a concept like No Language in MS Word. One could perhaps add a language like Afrikaans or Arabic and experiment with that?
Regards,
Uwe
Copy link to clipboard
Copied
Hello everybody!
A good way to solve the issue of syntax highlighting in InDesign is to use GREP Styles to do it. I've already found some scripts to use, but still none that I do it satisfactorily. I'm creating syntax highlighting for the Java language using GREP Styles, however, it's still quite laborious