Created
March 28, 2021 02:40
-
-
Save Tokubara/ca0933ed81b91a4d46d5a671b15a2cf2 to your computer and use it in GitHub Desktop.
多个markdown文件合并为一个markdown或者pdf文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_dir=build | |
source=~/Downloads/100-gcc-tips/md/src/*.md | |
title='gcc-100' | |
filename='gcc-100' | |
all: html epub rtf pdf mobi | |
markdown: | |
awk 'FNR==1{print ""}{print}' $(source) > $(filename).md | |
html: markdown | |
pandoc -s $(filename).md -t html5 -o index.html -c style.css \ | |
--include-in-header $(include_dir)/head.html \ | |
--include-before-body $(include_dir)/author.html \ | |
--include-before-body $(include_dir)/share.html \ | |
--include-after-body $(include_dir)/stats.html \ | |
--title-prefix $(title) \ | |
--toc-depth=4 \ | |
--toc | |
epub: markdown | |
pandoc -s $(filename).md -t epub -o $(filename).epub \ | |
--epub-metadata $(include_dir)/metadata.xml \ | |
--epub-cover-image img/cover.jpg \ | |
--title-prefix $(title) \ | |
--toc | |
rtf: markdown | |
pandoc -s $(filename).md -o $(filename).rtf \ | |
--title-prefix $(title) | |
pdf: markdown | |
# OS X: http://www.tug.org/mactex/ | |
# Then find its path: find /usr/ -name "pdflatex" | |
# Then symlink it: ln -s /path/to/pdflatex /usr/local/bin | |
# pandoc -s $(filename).md -o $(filename).pdf \ | |
# --title-prefix $(title) \ | |
# --listings -H listings-setup.tex \ | |
# --template=template/template.tex \ | |
# --pdf-engine=xelatex \ | |
# -V mainfont='Songti SC' -V monofont='Monaco' -V CJKmainfont='Songti SC' \ | |
# --toc | |
pandoc -s $(filename).md -o $(filename).pdf \ | |
--pdf-engine=xelatex \ | |
-V mainfont='Songti SC' -V monofont='Monaco' -V CJKmainfont='Songti SC' \ | |
--toc | |
mobi: epub | |
# Symlink bin: ln -s /path/to/kindlegen /usr/local/bin | |
kindlegen $(filename).epub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
来自于这个仓库