highlight code on slide/ppt

only for mac

问题
写ppt的时候代码如何呈现,能够看起来比较明显,更好是根据不同语言高亮

解决方案
highlight

  1. Install
    brew install highlight

  2. Use
    hightlight -l -O rtf your_code.sh | pbcopy

  • hightlight –help 可以查看文档,
  • -l 显示行号,-O rtf为格式化输出 rtf 格式文本
  • pbcopy 是内置剪贴板

到PPT里粘贴就行了,Keynote 和 PowerPoint 都可以使用.
example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
➜  ~ cat output.sh
docker exec -it -u root tw-jenkins bash

chmod 777 /var/run/docker.sock
apt-get update && \
apt-get -y install apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg > /tmp/dkey; apt-key add /tmp/dkey && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable" && \
apt-get update && \
apt-get -y install docker-ce

➜ ~ highlight -l -O rtf output.sh | pbcopy

highlight_demo01.png

Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2019-2024 John Doe
  • Visitors: | Views:

请我喝杯咖啡吧~