【发布时间】:2011-04-05 09:23:14
【问题描述】:
我需要在命令行处理 Markdown,所以没有真正的语言限制。
额外的功能,如漂亮的引号和破折号是受欢迎的补充。代码块是必须的,但我认为它们是核心的一部分。
我只想输出到 HTML,我在 Unix 环境中。
【问题讨论】:
我需要在命令行处理 Markdown,所以没有真正的语言限制。
额外的功能,如漂亮的引号和破折号是受欢迎的补充。代码块是必须的,但我认为它们是核心的一部分。
我只想输出到 HTML,我在 Unix 环境中。
【问题讨论】:
$ 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
【讨论】:
到目前为止,我一直在使用带有http://www.freewisdom.org/projects/python-markdown/ 的python 没有任何问题,并且它具有简单的扩展机制。
【讨论】:
还有折扣,David Parsons 将 John Gruber 的 Markdown 文本转换为 html 语言的 C 实现。 Discount 包含几个命令行工具,包括markdown、mkd2html、makepage、mktags 和theme。
【讨论】:
还推荐具有以下好处的 Pandoc:
很强大!
【讨论】:
我不确定最维护的是什么,我当然偏向于在这里使用它,但是 SO 使用的那个也可以在 github 上找到,它是 the markdownsharp project,写的在 C# 中,并且维护得很好。
它修复了 SO 用户在提出问题时发现的原始 Markdown 实现中的许多错误,就像大多数事情一样,只是一个出于必要的项目。话虽这么说,markdown 的某些工作方式按照规范的设计,但不一定是直观的,这是维护者在那里采取什么行动的特权,直观与规范......所以在某些极端情况下,您可能需要稍微调整任何实现以完全获得您想要的。
【讨论】: