pandoc实现文档不同格式的转换

Pandoc是一个文档格式转换器,Pandoc可以将下列格式文档进行相互转换。
Markdown、Microsoft Word、OpenOffice/LibreOffice、Jupyter notebook、HTML、EPUB、roff man、LaTeX和PDF。

安装与下载

具体的安装和简单教程可以看到:https://blog.csdn.net/xk_xx/article/details/104179256/
pandoc工具下载地址:https://github.com/jgm/pandoc/releases/tag/2.19.2

安装之后,可以通过在命令行界面运行如下命令查看是否成功:

[frank@LAPTOP-0OCJTGJR ~]$ pandoc --version
pandoc 1.12.3.1
Compiled with texmath 0.6.6, highlighting-kate 0.5.6.
Syntax highlighting is supported for the following languages:
    actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog,
    clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d,
    diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang,
    fortran, fsharp, gnuassembler, go, haskell, haxe, html, ini, java, javadoc,
    javascript, json, jsp, julia, latex, lex, literatecurry, literatehaskell,
    lua, makefile, mandoc, markdown, matlab, maxima, metafont, mips, modelines,
    modula2, modula3, monobasic, nasm, noweb, objectivec, objectivecpp, ocaml,
    octave, pascal, perl, php, pike, postscript, prolog, python, r,
    relaxngcompact, restructuredtext, rhtml, roff, ruby, rust, scala, scheme,
    sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo, verilog, vhdl,
    xml, xorg, xslt, xul, yacc, yaml
Default user data directory: /home/frank/.pandoc
Copyright (C) 2006-2013 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.

文档格式之间的转换

具体实例:

pandoc test.txt -o test.pdf

-o是指output的意思,将test.txt转为test.pdf。

注意,pandoc不能对pdf进行转换,但是可以使用latex的文件转word,这转化通常比较实用:

pandoc test.tex -o test.docx

具体的教程可以参考:
https://pandoc.org/MANUAL.html

猜你喜欢

转载自blog.csdn.net/winycg/article/details/127874059