There are highlight
etc. in the Homebrew package,
To be honest, they didn't highlight it as I expected
It's inconvenient because it's a method that can't be used for both PowerPoint and KeyNote. ..
So I will show you how to achieve source syntax highlighting with PowerPoint / Keynote.
If you already have a python 3.x system environment, please skip it.
pyenv
Like Ruby, I want to manage the version of Python easily, so I introduced pyenv
.
Since I am using a Mac, I installed it via Homebrew.
python
$ brew install pyenv
2014/07/30 Installed the latest version 3.4.1.
python
$ pyenv install 3.4.1
$ pyenv rehash
See the post-installation prompt for post-installation PATH and completion settings.
python
$ pyenv global 3.4.1
$ pyenv versions
system
* 3.4.1
Make sure that 3.4.1 is checked.
Install Pygments
with pip
in Python's package management system.
python
$ pip install Pygments
$ pyenv rehash
python
$ pygmentize -f FILE_PATH | pbcopy
--Paste to PowerPoint / KeyNote with ⌘ + V
――If you do "Keep format and copy", the color will be reflected.
--Adjust the font size as appropriate
--Note that Japanese characters in comments are garbled. --It is necessary to devise such as editing only the Japanese part later.
see also: https://gist.github.com/ept/4475995
Recommended Posts