How To Format A Block of Code Within a Presentation? [closed]
Asked Answered
L

8

173

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.

Lovering answered 11/11, 2008 at 14:31 Comment(3)
If you copy from InteliJ products it will just work :)Acquaintance
Check out Code Highlight 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.)Slub
use Visual Studio Code for the Web "vscode.dev" and just copy paste or just copy paste from local VS CodeBruno
T
185

An on-line syntax highlighter:

http://hilite.me/

Just copy and paste into your document.

Tall answered 24/8, 2012 at 20:52 Comment(9)
Presentation no longer lets you add arbitrary html.Making
@iliacholy You can just copy and paste the text from the preview box instead of using the HTML codeTall
it would be cool if it also indented..Sonorant
romannurik.github.io/SlidesCodeHighlighterBaram
This service is unavailablePisolite
Hey @RobotEyes! looks like the service is not available nowRatib
I've added an alternative serviceTall
markup.su/highlighter is dead now, as wellTribute
This worked great for me: snappify.com I can export a simple code snippet for free.Stridulate
Y
23

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

Younglove answered 11/11, 2008 at 14:47 Comment(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: fauskes.net/nb/syntaxms But I'm using LINUX and oowriter doesn't have this option.Abducent
S
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.

Sip answered 12/11, 2008 at 3:27 Comment(0)
S
8

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

Sepulture answered 8/10, 2014 at 20:57 Comment(5)
Unfortunately, this only works for Doc and Spreadsheet and not Presentation, which is what the question is about.Wassail
now it works also for presentation. They probably added the featureTouter
Can't tweak colors of this add on...made it less usefulMisdemean
@GameDeveloper how did yo umanage to get it working in presentations?Sewellyn
Oh. it was a old comment. Who remember.. so much changed in 2 years. Maybe I copy pasted from another editor supporting markup. I really don't remember XDTouter
O
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. :)

Osseous answered 15/1, 2014 at 5:8 Comment(0)
M
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.
Montfort answered 11/11, 2008 at 14:34 Comment(0)
Y
2

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

Younglove answered 11/11, 2008 at 18:14 Comment(0)
O
0

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.

Overpay answered 12/10, 2011 at 12:33 Comment(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.Terni
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.Overpay

© 2022 - 2024 — McMap. All rights reserved.