网站上的 Markdown 预览

Markdown preview on website

我可以在 Web 上预览我将创建的 .md 文件吗?或者我必须将 .md 转换为 .html 文件? 因为我想用 markdown 写,并且不经过任何转换就上传文章。可能吗?

  1. 嗯,markdown 不是 html 标准的一部分,因此您需要一个程序来解析确实存在的 markdown。所以这是可能的。
  2. 您可以在 stackedit. I use jekyll 等网站上预览您正在编写的 markdown,将我的 markdown 文件转换为 html 文件并以这种方式上传。难度不大。

有一个节点模块可以将 markdown 文件转换为 html 个文件。

在一个项目中

Install npm install -D markdown-folder-to-html
Add docs to npm scripts {"scripts": {"docs": "markdown-folder-to-html"}}
npm run docs and open _docs/index.html

全球

Install npm install -g markdown-folder-to-html
cd markdown-folder-to-html/ and open _docs/index.html

示例:

mkdir -p docs
Add some docs echo "**Banana**" > docs/banana.md
Add some docs echo "**Apple**" > docs/index.md

markdown-folder-to-html docs/  // it will create _docs folder which contains html preview of markdown

安装指南:https://chimeces.com/markdown-folder-to-html/