码迷,mamicode.com
首页 > 其他好文 > 详细

keynote代码高亮【转】

时间:2014-09-05 02:09:40      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:http   io   ar   for   文件   cti   代码   sp   log   

码农即使做ppt,也离不开代码,在keynote下,如果要粘贴代码,如何做到语法高亮呢?

补充1,该功能由pygments提供支持,所以支持的语言见:http://pygments.org/languages/

补充2,下文中的直接转化剪贴板里的内容,设置语言为-S py,其中py的意思是如果这段代码存成文件的话,应该是.py,所以,如果你想要贴一段objective-c的代码,显然就是-s m了。

原文和出处转载如下,不另行翻译了:

http://www.peterbe.com/plog/highlighted-code-syntax-in-keynote

Do you want to display some code in a Keynote presentation?

It‘s easy. All you need is Homebrew installed.

First you need to install the program highlight.

$ brew install highlight

So you have a piece of code. For example some Python code. The take that snippet of code and save it to a file like code.py. Now all you need to do is run this:

$ highlight -O rtf code.py | pbcopy

Then, switch back into Keynote and simply paste.

But if you don‘t want to create a file of the snippet, simply copy the snippet from within your editor and run this:

$ pbpaste | highlight -S py -O rtf | pbcopy

The -S py means "syntax is py (for python)".

You can use highlight for a bunch of other things like creating HTML. See man highlight for more tips.

keynote代码高亮【转】

标签:http   io   ar   for   文件   cti   代码   sp   log   

原文地址:http://www.cnblogs.com/walkerwang/p/3957144.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!