markdown在ubuntu上的使用

Markdown在ubuntu下的使用


工具的使用

安装的软件如下:

  • sudo apt-get install retext
  • retext Release-Notes.md
  • sudo apt-get install discount
  • sudo apt-get install python-markdown
    • sudo apt-get install python-pisa

说明

  • retext是编辑器
  • discount和python-markdown是转换成html的工具,如下:
    • 用discount提供的markdown工具
    • markdown -o Release-Notes.html Release-Notes.md
    • 用python-markdown提供的markdown_py工具
    • markdown_py -o html4 Release-Notest.md > Release-Notes.html
    • sudo apt-get install python-pisa
    • 将html转换成PDF
    • xhtml2pdf –html Release-Notes.html Release-Notes.pdf

制作一个Makefile

  • 代码如下:

Makefile

MD = markdown
MDFLAGS = -T
H2P = xhtml2pdf
H2PFLAGS = --html
SOURCES := $(wildcard *.md)
OBJECTS := $(patsubst %.md, %.html, $(wildcard *.md))
OBJECTS_PDF := $(patsubst %.md, %.pdf, $(wildcard *.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)
  • Makefile使用,直接用make html或者make pdf输出即可
posted @ 2014-06-25 14:05  海滨银枪小霸王  阅读(600)  评论(0编辑  收藏  举报