168

I am preparing a presentation using Google Slides, though I can also work on the presentation within Open Office that will include code snippets.

Is there any easy way to perform basic syntax highlighting on the code snippets with either Google Docs or Open Office Presenter?

Edit: Since I believe that I can find a way to embed HTML, any tools that can perform syntax highlighting on HTML would also be welcome suggestions.

Bryan Miller
  • 3,262
  • 4
  • 27
  • 51
Noah Goodrich
  • 24,875
  • 14
  • 66
  • 96
  • 1
    If you copy from InteliJ products it will just work :) – Gelldur May 28 '15 at 14:58
  • Check out [Code Highlight](https://codehighlight.software) add-on. It highlights a block of code in Slides presentation. Supports a wide variety of syntaxes (React, Vue, C++, Go etc.) & offers the most popular themes on the market (VS Code, Cobalt, One Dark etc.) – Vladimir Mikulic Oct 08 '20 at 14:10
  • use Visual Studio Code for the Web "https://vscode.dev/" and just copy paste or just copy paste from local VS Code – softawareblog.com Mar 02 '23 at 18:58

8 Answers8

183

An on-line syntax highlighter:

http://hilite.me/

Just copy and paste into your document.

RobotEyes
  • 4,929
  • 6
  • 42
  • 57
23

http://www.tohtml.com/ created syntax highlighted HTML code for lots of languages. It might be what you're looking for.

robintw
  • 27,571
  • 51
  • 138
  • 205
  • 1
    The problem is what to do after that. I installed qt-source-highlight and got the HTML. But OOO Presentation doesn't seems to have an option to insert HTML, nor can I find some program to export the syntax with another option (like RTF for example). For windows, I found this answer: http://www.fauskes.net/nb/syntaxms/ But I'm using LINUX and oowriter doesn't have this option. – DrBeco Mar 30 '11 at 04:25
9

If you're using Visual Studio (this might work in Eclipse also, but I never tried) and you copy & paste into Microsoft Word (or any other microsoft product) it will paste the code in whatever color your IDE had. Then you just need to copy the text out of word and into your desired application and it will paste as rich text.

I've only seen this work across Visual Studio to other Microsoft products though so I don't know if it will be any help.

Dan Herbert
  • 99,428
  • 48
  • 189
  • 219
7

With the new Add-Ons for Google Drive, you can get code highlighting with the Code Pretty add-on.

rb195048
  • 101
  • 1
  • 5
4

I've also thought of this. Finally, my solution is to use github gist. Don't forget it also has highlight functionality. Just copy it. :)

bluesea
  • 429
  • 4
  • 9
3

Just a few suggestions:

  • Screenshots might be an easy way, but you'll have to make sure the code in the image is big enough and clear enough to read. (not the whole screenshot, just the relevant part)
  • If you can embed html then there are lots of tools to generate syntax highlighted html.
vfilby
  • 9,938
  • 9
  • 49
  • 62
2

If you write your code in emacs then you might be interested in the htmlize elisp package.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
robintw
  • 27,571
  • 51
  • 138
  • 205
1

Check out http://codepad.org. It probably won't solve the poster's problem; but, I think it will be of use to others who read this article.

Zack
  • 6,232
  • 8
  • 38
  • 68
  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Erik Schierboom Oct 04 '15 at 08:42
  • 1
    This isn't an article, it is the link to a tool that may have some of the desired features. If the link changes and the tool becomes unavailable, the answer becomes irrelevant. – Zack Oct 09 '15 at 01:23