Write Markdown Syntax Online Document with Sphinx and Pandoc
There is no doubt that we have to write doc while we are developing software. But How do you
write doc? I learnt a method to build a document by using markdown syntax with sphinx and pandoc.
It is quite elegant and convenient to use it. I am sure you will like it.
Firstly, I write the markdown doc in .md file, then I will convert it to .rst file. After converting the file,
I will use sphinx to convert it into HTML file, you can see the doc online. Here is the way as following on ubuntu:
1.To run doc and convert file, pakcages should be installed:
apt-get install pandoc
apt-get install python-sphinx
2.Run command to configure environment:
sphinx-quickstart
After configuration, we can popluate master file source/index.rst and create other document source .rst file. Use the
Makefile to build the docs, like so:
make builder
"builder" is one te supported buidlers, e.g. html, latex or linkcheck.
Here is the turtorial:
3. Write doc
Under the directory ./source, we create source .md files, such as
doc1.md
doc2.md
...
docn.md
Add the .md file name above in the file ./source/index.rst
doc1
doc2
...
docn
4. Convert .md files to .rst files
We can write a script run_doc.sh:
#!/bin/bash
## run_doc.sh files=./source/*.md for file in $files
do
pandoc "$file" -o "${file%.md}.rst"
done
After converting files, we can see doc1.rst, doc2.rst ... in the directory ./source
5. Convert .rst files to html files
make html
You can see the html files under the directory: build/html
Attachment:
#!/bin/bash ## run_doc.sh files=./source/*.md for file in $files
do
pandoc "$file" -o "${file%.md}.rst"
done make html
6. Visit online doc
Add configuration in Nginx:
location /doc/ {
alias [direcotry]/build/html/;
}
Replace [directory] with your own home directory. Visit online doc:
http://[website]/doc/index.html
Replace [website] with your own website.
7. Online markdown editor
http://mahua.jser.me
Link: http://www.cnblogs.com/zhuangzebo/p/6268964.html
Write Markdown Syntax Online Document with Sphinx and Pandoc的更多相关文章
- 【445】Markdown Syntax
ref: Markdown基本语法 ref: Markdown Guide ref: Markdown Cheatsheet ref: Markdown Tutorial Lists Basic Sy ...
- Markdown: Syntax Text
Markdown: Syntax Text https://daringfireball.net/projects/markdown/syntax.text Markdown: Syntax ==== ...
- Markdown Syntax Images
Markdown Syntax Images Admittedly, it's fairly difficult to devise a "natural" syntax for ...
- Markdown syntax guide and writing on MWeb
Philosophy Markdown is intended to be as easy-to-read and easy-to-write as is feasible.Readability, ...
- markdown syntax
Markdown 语法 转载自https://zh.mweb.im/markdown.html 首先应该了解的 每一个 Markdwon 使用者都应该了解的,是 Markdown 最基本的版本,也就是 ...
- Markdown语法说明(详解版)
####date: 2016-05-26 20:38:58 tags: Markdown tags && Syntax ##Markdown语法说明(详解版)杨帆发表于 2011-11 ...
- New UWP Community Toolkit - Markdown
概述 前面 New UWP Community Toolkit 文章中,我们对 V2.2.0 版本的重要更新做了简单回顾,其中简单介绍了 MarkdownTextBlock 和 MarkdownDoc ...
- Markdown语法说明(转)
Markdown语法说明(转) Markdown创始人John Gruber的语法说明 附上本文链接 NOTE: This is Simplelified Chinese Edition Docume ...
- Sphinx 2.2.11-release reference manual
1. Introduction 1.1. About 1.2. Sphinx features 1.3. Where to get Sphinx 1.4. License 1.5. Credits 1 ...
随机推荐
- go语言中的反射reflect
package main; import ( "fmt" "reflect" ) //反射refection //反射使用TypeOf和ValueOf函数从接口 ...
- 记录css的常用属性
background-color:背景颜色 color:字体颜色 text-align:标签内容的位置 margin-left:左外边距 font-size:字体大小 font_family:字体格式 ...
- Java并发-volatile的原理及用法
Java并发-volatile的原理及用法 volatile属性:可见性.保证有序性.不保证原子性.一.volatile可见性 在Java的内存中所有的变量都存在主内存中,每个线程有单独CPU缓存内存 ...
- PAT 1017 A除以B(20)(代码)
1017 A除以B(20 分) 本题要求计算 A/B,其中 A 是不超过 1000 位的正整数,B 是 1 位正整数.你需要输出商数 Q 和余数 R,使得 A=B×Q+R 成立. 输入格式: 输入在一 ...
- PDO 代码
<?php try{ $dsn = "mysql:dbname=mydb;host=localhost"; $pdo = new PDO($dsn,"root&qu ...
- hdu 1026(BFS+输出路径) 我要和怪兽决斗
http://acm.hdu.edu.cn/showproblem.php?pid=1026 模拟一个人走迷宫,起点在(0,0)位置,遇到怪兽要和他决斗,决斗时间为那个格子的数字,就是走一个格子花费时 ...
- HDOJ4734 F(x)
原题链接 数位\(DP\),继续套记搜模板 定义\(f[pos][now]\),\(pos\)是枚举到的位数,\(now\)是\(A\)的权值减去当前枚举的数的权值,即剩余权值大小. 然后就是记搜模板 ...
- LibreOJ 6003. 「网络流 24 题」魔术球 贪心或者最小路径覆盖
6003. 「网络流 24 题」魔术球 内存限制:256 MiB时间限制:1000 ms标准输入输出 题目类型:传统评测方式:Special Judge 上传者: 匿名 提交提交记录统计讨论测试数据 ...
- [SoapUI] 判断工程下某个文件是否存在,存在就删除
def excelName = "AllTests-Fails" String projectPath = context.expand( '${projectDir}' ) St ...
- linux关机命令-shutdown
shutdown1.作用shutdown命令的作用是关闭计算机.root用户关机时,不管是否还有其他登录用户,都会关机:如果是非root用户关机,如果还有其他的登录用户,将会提示不能关机.2.格式sh ...