PDA

View Full Version : How to enable Syntax Highlighting


Mike12345
02-05-2011, 12:24 PM
Hello,

i would like to copy & paste source code from a browser window to a UR text item. How can i enable syntax highlighting for those items?
Is there a easy way to do this?

quant
02-05-2011, 02:33 PM
I usually paste some code snippet to IDE where it changes font and color and then copy/paste from there, so it's a two step procedure.

Mike12345
02-05-2011, 03:40 PM
Nice Workaround, quant. :-)

Is there a better way? Maybe change the template item to "Source code" or something similar?

kinook
02-06-2011, 09:19 AM
Syntax highlighting in rich text items isn't support (except for static highlighting when copying formatted RTF as quant described).

Another option is to import a source code file as a template in UR and use UR's text file syntax highlighting.
http://www.kinook.com/UltraRecall/Manual/editordialog.htm

After creating a text file template item, create new items from that template and copy/paste source code into it.

Mike12345
02-07-2011, 09:27 AM
Works as needed, thank you very much! :-)

One minor glitch - the new source code template does not have a scrollbar.

kinook
02-07-2011, 09:56 AM
If the text doesn't all fit in the window, it should display a scroll bar.

Roaster
02-09-2011, 01:47 PM
Originally posted by kinook
After creating a text file template item, create new items from that template and copy/paste source code into it. [/B]
Does this imply that the copied text is still editable? If I remember right, when importing a source code file, eg JavaScript, the syntax is highlighted however the text is not editable.

kinook
02-09-2011, 01:53 PM
Yes, see http://www.kinook.com/Forum/showthread.php?threadid=4778

Roaster
02-10-2011, 06:09 AM
Thanks for your reply.

I've now added .js to the list here: Tools | Options | Documents | File extensions.
The option "allow internal editing of linked documents" is set to true.

Afterwards I've used drag and drop to insert a blank file named JavaScript.js into the template folder inside UR.

My intention was to have a template which shows syntax highlighting each time I'm creating a new item based on this template. However, the new item and the template as well just shows a link "Click here to open linked document" instead of an editor.

Did I made sthg. wrong? I've restarted UR after setting the new options, btw.

EDIT: I got this running somehow, although I do not know exactly which steps I took. Perhaps inserting a *not* blank JavaScript.js file instead of an empty one did the trick.

kinook
02-10-2011, 07:12 AM
Right, the imported document can't be completely empty. It must contain at least a single character (could be a space or newline) in order to be stored rather than linked.