什么是最成熟和最维护的Markdown处理器?

时间:2010-08-29 10:11:04

标签: html unix markdown

我需要在命令行处理Markdown,因此没有真正的语言限制。

漂亮的引号和破折号等额外功能是一个值得欢迎的补充。代码块是必须的,但它们是我认为核心的一部分。

我只想输出到HTML,而且我在Unix环境中。

6 个答案:

答案 0 :(得分:22)

Pandoc允许您将Markdown转换为HTML(以及返回!)和much more

答案 1 :(得分:9)

$ pandoc --help
pandoc [OPTIONS] [FILES]
Input formats:  
       native, json, markdown, markdown+lhs, rst, rst+lhs, 
       textile, html, latex, latex+lhs
Output formats:  
      native, json, html, html+lhs, s5, slidy, docbook, 
      opendocument, latex, latex+lhs, context, texinfo, 
      man, markdown, markdown+lhs, plain, rst, rst+lhs, 
      mediawiki, textile, rtf, org, odt, epub
Options:
  -f FORMAT, -r FORMAT  --from=FORMAT, --read=FORMAT                    
  -t FORMAT, -w FORMAT  --to=FORMAT, --write=FORMAT                     
  -s                    --standalone                                    
  -o FILENAME           --output=FILENAME                               
  -p                    --preserve-tabs                                 
                        --tab-stop=NUMBER                               
                        --strict                                        
                        --normalize                                     
                        --reference-links                               
  -R                    --parse-raw                                     
  -S                    --smart                                         
  -5                    --html5                                         
  -m[URL]               --latexmathml[=URL], --asciimathml[=URL]        
                        --mathml[=URL]                                  
                        --mimetex[=URL]                                 
                        --webtex[=URL]                                  
                        --jsmath[=URL]                                  
                        --mathjax[=URL]                                 
                        --gladtex                                       
  -i                    --incremental                                   
                        --offline                                       
                        --xetex                                         
                        --chapters                                      
  -N                    --number-sections                               
                        --listings                                      
                        --section-divs                                  
                        --no-wrap                                       
                        --columns=NUMBER                                
                        --ascii                                         
                        --email-obfuscation=none|javascript|references  
                        --id-prefix=STRING                              
                        --indented-code-classes=STRING                  
                        --toc, --table-of-contents                      
                        --base-header-level=NUMBER                      
                        --template=FILENAME                             
  -V KEY:VALUE          --variable=KEY:VALUE                            
  -c URL                --css=URL                                       
  -H FILENAME           --include-in-header=FILENAME                    
  -B FILENAME           --include-before-body=FILENAME                  
  -A FILENAME           --include-after-body=FILENAME                   
  -T STRING             --title-prefix=STRING                           
                        --reference-odt=FILENAME                        
                        --epub-stylesheet=FILENAME                      
                        --epub-cover-image=FILENAME                     
                        --epub-metadata=FILENAME                        
  -D FORMAT             --print-default-template=FORMAT                 
                        --bibliography=FILENAME                         
                        --csl=FILENAME                                  
                        --natbib                                        
                        --biblatex                                      
                        --data-dir=DIRECTORY                            
                        --dump-args                                     
                        --ignore-args                                   
  -v                    --version                                       
  -h                    --help

$ pandoc --version
pandoc 1.8.2

Compiled with citeproc support.

Compiled with syntax highlighting support for:

Actionscript, Ada, Alert, Alert_indent, Ansys, Apache, 
Asn1, Asp, Awk, Bash, Bibtex, Boo, C, Changelog, Cisco, 
Cmake, Coffeescript, Coldfusion, Commonlisp, Cpp, Cs, 
Css, Cue, D, Desktop, Diff, Djangotemplate, Doxygen, 
Doxygenlua, Dtd, Eiffel, Email, Erlang, Fortran, Fsharp, 
Fstab, Gap, Gdb, Gettext, Gnuassembler, Go, Haskell, 
Haxe, Html, Idl, Ilerpg, Ini, Java, Javadoc, Javascript, 
Json, Jsp, Latex, Lex, LiterateHaskell, Lua, M3u,  
Makefile, Mandoc, Matlab, Maxima, Mediawiki, Metafont, 
Mips, Modula2, Modula3, Monobasic, Nasm, Noweb, 
Objectivec, Objectivecpp, Ocaml, Octave, Pango, Pascal, 
Perl, Php, Pike, Postscript, Prolog, Python, R, 
Relaxngcompact, Rhtml, Ruby, Scala, Scheme, Sci, Sed, 
Sgml, Sql, SqlMysql, SqlPostgresql, Tcl, Texinfo, 
Verilog, Vhdl, Winehq, Wml, Xharbour, Xml, Xorg, Xslt, 
Xul, Yacc, Yaml
Copyright (C) 2006-2011

答案 2 :(得分:3)

到目前为止,我一直在使用http://www.freewisdom.org/projects/python-markdown/的python而没有任何问题,它有一个简单的扩展机制。

答案 3 :(得分:3)

还有一个折扣,David Parsons将John Gruber的Markdown文本实现为html语言。折扣包含多个命令行工具,包括markdownmkd2htmlmakepagemktagstheme

http://www.pell.portland.or.us/~orc/Code/discount/

答案 4 :(得分:3)

同时推荐Pandoc以下优惠:

  1. pandoc markdown中的代码语法突出显示非常适合html,并且它正在增长!
  2. pandoc markdown支持类似于github flavored markdown
  3. 除了html之外还有更多的输出格式,这可能是你以后需要的,比如电子书
  4. 它很强大!

答案 5 :(得分:2)

我不确定大多数维护的是什么,我在这里使用它肯定有偏见,但SO使用的那个也可以在github上使用,它是the markdownsharp project ,用C#编写,维护得很好。

它修复了原始降价实施中的许多错误,这些错误是由SO用户发现的,因为大多数事情都是问题,只是一个必要的项目。话虽这么说,降价工作的一些方法是按照规范设计,但不一定是直观的,它是维护者在那里采取什么行动,直观和规范的特权......所以您可能需要稍微调整任何实现,以便在某些边缘情况下完全您想要的内容。