(轉)https://www.jianshu.com/p/69b536f5c11fcss
% MAC下利用pandoc+markdown來寫slide
pandoc是一款開源轉換工具,能夠實現常見的格式轉換。支持全平臺操做,以命令行的方式進行轉換。html
寫一份markdown文件, 根據須要能夠生成:html5
brew install pandoc brew tap phinze/cask brew install brew-cask brew cask install mactex
# today ## morning - I want to have breakfast ## afternoon - I want to have lunch
pandoc -D latex > mytemplate.tex
pandoc test.md -o test.pdf -t beamer --latex-engine=xelatex --template=mytemplate.tex
直接執行是不成功的。git
修改mytemplate.texgithub
\ifxetex \usepackage{hyperref} \usepackage{fontspec,xltxtra,xunicode} \defaultfontfeatures{Mapping=tex-text} \usepackage{xeCJK} \setCJKmainfont[BoldFont = Hiragino Sans GB W6]{Hiragino Sans GB W3} \setCJKsansfont[BoldFont=SimHei]{SimHei} \setCJKmonofont{SimHei} \else \usepackage[unicode=true]{hyperref} \fi
git clone https://github.com/hakimel/reveal.js pandoc slides.md -o slides.html -t revealjs -s -V theme=beige
這樣是執行不成功的shell
不要用reveal 3.0, 用reveal.js 2.6markdown
利用makefile來自動化構建app
slide:${f} pandoc ${f} -o pdf_slide/${f}.pdf -t beamer --latex-engine=xelatex --template=./mytemplate.tex pdf:${f} pandoc ${f} -o pdf_doc/${f}.pdf --latex-engine=xelatex --template=./mytemplate.tex reveal:${f} pandoc ${f} -o html_slide/${f}.html -t revealjs -s -V theme=beige all:${f} slide pdf reveal echo "ok" print:${f} echo ${f}
make slide f=pandoc_setup.md make pdf f=pandoc_setup.md make reveal f=pandoc_setup.md
. ├── Makefile ├── html_slide │ ├── pandoc_setup.md.html │ └── reveal.js ├── mytemplate.tex ├── pandoc_setup.md ├── pdf_doc │ └── pandoc_setup.md.pdf └── pdf_slide └── pandoc_setup.md.pdf
做者:胡大善人
連接:https://www.jianshu.com/p/69b536f5c11f
來源:簡書ide