html格式转markdown格式化,如何将表格转成MarkDown或HTML格式

本文介绍了如何使用Pandoc工具将Markdown文件转换为HTML格式,以及其他格式之间的互转。通过简单的命令行操作,可以实现Markdown、HTML、LaTeX等格式之间的自由转换,大大提升了文档处理的效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

markdown虽然写起来方便, 但是要预览的话还要用ReText打开, 而且ReText好像是Qt程序, 打开文件时不如别的编辑器那么流畅. 所以想找一个可以把markdown文件变成html格式的工具.

我甚至搜了很久"markdown2html"(github上居然可以搜到好几个项目...) 而没有注意到, 在终端输入"html2markdown"时显示的警告:

$ html2markdown

程序“html2markdown”尚未安装。 您可以使用以下命令安装:

sudo apt-get install pandoc

后来安装了pandoc(sudo apt-get install pandoc), 其实只要看看帮助就知道咋用了:

$ pandoc -h

pandoc [OPTIONS] [FILES]

Input formats: native, markdown, markdown+lhs, rst, rst+lhs, html, latex, latex+lhs

Output formats: native, html, html+lhs, s5, docbook, opendocument, odt, latex, latex+lhs, context, texinfo, man, markdown, markdown+lhs, plain, rst, rst+lhs, mediawiki, rtf

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=TABSTOP

--strict

--reference-links

-R --parse-raw

-S --smart

-m[URL] --latexmathml[=URL], --asciimathml[=URL]

--mathml[=URL]

--mimetex[=URL]

--jsmath[=URL]

--gladtex

-i --incremental

--xetex

-N --number-sections

--no-wrap

--sanitize-html

--email-obfuscation=none|javascript|references

--id-prefix=STRING

--indented-code-classes=STRING

--toc, --table-of-contents

--base-header-level=LEVEL

--template=FILENAME

-V FILENAME --variable=FILENAME

-c URL --css=URL

-H FILENAME --include-in-header=FILENAME

-B FILENAME --include-before-body=FILENAME

-A FILENAME --include-after-body=FILENAME

-C FILENAME --custom-header=FILENAME

-T STRING --title-prefix=STRING

--reference-odt=FILENAME

-D FORMAT --print-default-template=FORMAT

--data-dir=DIRECTORY

--dump-args

--ignore-args

-v --version

-h --help

真是more than I've expected! markdown/rst/html/latex之间可以互转!

使用pandoc命令就可以在随便转换了, 示例, 把demo.md输出成demo.html:

$pandoc -f markdown -t html -o demo.html demo.md

或者直接:

$pandoc -f markdown -t html -o demo.html demo.md

我觉得这个实在是很有用的一条命令~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值