keynote代碼高亮【轉】

來源:互聯網
上載者:User

標籤: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代碼高亮【轉】

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.