Jump to content
You must now use your email address to sign in [click for more info] ×

[Feat. Request] Syntax Highlighting for Code Text Frames


Recommended Posts

Hi,

technical authors – myself included – may need to design books that include programming code (C++, JavaScript, Python, you name it) with proper syntax highlighting. As discussed at length in this thread, copy & paste from the code editor (e.g. Visual Studio Code, Sublime Text, Atom, etc.) to a Text Frame doesn't work. Besides, it seems that Edit > Paste Special is a Win only feature of Publisher.

The one workaround available involves an intermediate step:

  1. Copy from the code editor.
  2. Paste to an application such as Word, Apple Pages, LibreOffice.
  3. Copy from Word/Pages/etc. and paste to Publisher text frame.

This way, as far as I get, the proper Rich Text information is preserved. Although the process works, the extra step is not only tedious, but doesn't scale up when the book contains a good deal of code samples that must be maintained in an easier, faster fashion.

It would be much handier to have the option to either select a portion of text in a Text Frame and assign the Language (programming language) that automatically triggers the appropriate syntax highlighting. Or have a Code Text Frame as a separate tool altogether, with properties, options and such.

Thank you!

Davide Barranca

Link to comment
Share on other sites

I can see how this could be very useful for a small segment of users, but it may well be too much effort for Serif to implement (and for how many languages?) for a relatively small market. That's just a guess, of course.

My hunch is that this would be an case for a third-party plugin were such a thing possible. It would be nice to have some kind of plugin or extension architecture.

Link to comment
Share on other sites

Sure enough, it'd be nice to have an environment/API that would allow such third-party plugins. I can't wait!
I do acknowledge that it isn't the first feat. request that may cheer the average user, but this doesn't mean one shouldn't log a request anyway :-)

As for the user segmentation, as a technical author I am evaluating myself whether to go with Affinity or stick to the MarkDown -> LaTeX -> PDF workflow (either Pandoc, LeanPub or SoftCover). Both choices have their pros and cons...

Davide

Link to comment
Share on other sites

  • 4 weeks later...

If a sufficiently flexible conditional formatting feature (such as the misnamed "grep formats" or whatever they are calling them these days) were to be implemented, there are probably a few languages which could be handled by those, though it wouldn't cover all of them without some form of hierarchical context between the styles, which would make development of syntax highlighting using conditional formats a possibility.

A hierarchical context between such formats does not seem like an unreasonable extension to Publisher, and conditional formats in general are wanted by many and should definitely be added, so I'm not so sure that this is too marginal to be considered as part of the main program.  I wouldn't expect them to provide the actual syntax parsing, but the facilities to create the styles ourselves seem fair enough?

As to the copy/paste from a text editor, if doing so with another program works and maintains the highlighting, then that is a VERY reasonable request for the Affinity apps - to recognize the additional clipboard format(s) involved and retain the formatting.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.