$ sudo apt-get install discount
$ sudo apt-get install python-markdown
使用方法
markdown -o Release-Notes.html Release-Notes.md
$ markdown_py -o html4 Release-Notest.md > Release-Notes.html
如果生成PDF文件使用
$ sudo apt-get install python-pisa
$ xhtml2pdf --html Release-Notes.html Release-Notes.pdf
批量递归目录修改md为html脚本
# Makefile
DIRS = $(shell find . -type d)
MD = markdown
MDFLAGS = -T
H2P = xhtml2pdf
H2PFLAGS = --html
SOURCES := $(foreach dir,$(DIRS),$(wildcard $(dir)/*.md))
OBJECTS := $(patsubst %.md, %.html, $(foreach dir,$(DIRS),$(wildcard $(dir)/*.md)))
OBJECTS_PDF := $(patsubst %.md, %.pdf, $(foreach dir,$(DIRS),$(wildcard $(dir)/*.md)))
all: build
build: html pdf
pdf: $(OBJECTS_PDF)
html: $(OBJECTS)
$(OBJECTS_PDF): %.pdf: %.html
$(H2P) $(H2PFLAGS) $< > $@
$(OBJECTS): %.html: %.md
$(MD) $(MDFLAGS) -o $@ $<
clean:
rm -f $(OBJECTS)
输出html
$ make html
输出pdf
$ make pdf
预防转换的html乱码,给md文件增加编码
$ sed -i '1i\' *.md
更好的工具转换为(包含输出html和PDF)
$ sudo apt-get autoremove pandoc
$ sudo apt-get install cabal-install$ cabal update$ cabal install pandoc
$ pandoc Release-Notest.md -o Release-Notes.html
$ pandoc Release-Notest.md -o Release-Notes.pdf
开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明ubuntu 递归批量markdown(md)转html或PDF文件!