Mobile app version of vmapp.org
Login or Join
Tiffany317

: Syntax highlighting in InDesign with presets for HTML, CSS and Javascript? I want to use code in an inDesign document, and for that to be easily readable and pretty, I am looking for a way

@Tiffany317

Posted in: #AdobeIndesign

I want to use code in an inDesign document, and for that to be easily readable and pretty, I am looking for a way to get a syntax highlighting as in texteditors like notepad++, Sublime Text and Atom.

Since I need real syntax highlighting (so that, for example, different data types are depicted with different colors), it is not sufficient to assign colors to certain characters (like the brackets). Also it would be nice if I could manually change in which color certain elements are depicted, but that's not absolutely necessary. Since I want to use different code types (mostly HTML, CSS and Javascript), it would be too much work to manually assign parameters on when to highlight what, so I need something that has presets for at least the three languages mentioned above.

Of course, I could use screenshots, but I don't want that since the code should be copyable (is this even a word? LOL) ...

So, is there a way to either get the syntax highlighting from the texteditors mentioned above into inDesign or achieve a similar effect in inDesign itself?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Tiffany317

2 Comments

Sorted by latest first Latest Oldest Best

 

@Yeniel278

Use something like,


Highlight, the command line version may be a good idea,
Scite, open and export (can also be used via cmd),
any of the JavaScript code highlighters,
etc.


to convert your code into RTF or HTML with styles then place that into InDesign.

10% popularity Vote Up Vote Down


 

@Murray976

I think the closest you could get with having something automated inside InDesign would be using Paragraph Styles with Character Styles nested inside them. However, this will be pretty limited since it expects a consistent linear form such as A B C, and depending on your code, you may often have A C C B.

To my knowledge, InDesign has no means of accomplishing the more granular syntax highlighting that would be required for this. If I absolutely had to do this natively in InDesign, I would probably assign shortcut keys to some Para/Chara Styles, and do it manually.

If you are good with code, you could probably write something to generate an IDML file for each block of code, which you could then File > Place in to your document and the appropriate syntax highlighting would come in with it (if you'd figured out a way to generate the IDML properly).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme