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的更多相关文章

  1. 【445】Markdown Syntax

    ref: Markdown基本语法 ref: Markdown Guide ref: Markdown Cheatsheet ref: Markdown Tutorial Lists Basic Sy ...

  2. Markdown: Syntax Text

    Markdown: Syntax Text https://daringfireball.net/projects/markdown/syntax.text Markdown: Syntax ==== ...

  3. Markdown Syntax Images

    Markdown Syntax Images Admittedly, it's fairly difficult to devise a "natural" syntax for ...

  4. 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, ...

  5. markdown syntax

    Markdown 语法 转载自https://zh.mweb.im/markdown.html 首先应该了解的 每一个 Markdwon 使用者都应该了解的,是 Markdown 最基本的版本,也就是 ...

  6. Markdown语法说明(详解版)

    ####date: 2016-05-26 20:38:58 tags: Markdown tags && Syntax ##Markdown语法说明(详解版)杨帆发表于 2011-11 ...

  7. New UWP Community Toolkit - Markdown

    概述 前面 New UWP Community Toolkit 文章中,我们对 V2.2.0 版本的重要更新做了简单回顾,其中简单介绍了 MarkdownTextBlock 和 MarkdownDoc ...

  8. Markdown语法说明(转)

    Markdown语法说明(转) Markdown创始人John Gruber的语法说明 附上本文链接 NOTE: This is Simplelified Chinese Edition Docume ...

  9. 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 ...

随机推荐

  1. Mac Terminal

    一.简介   二.实用 1)update-apps-using-terminal-mac https://www.maketecheasier.com/update-apps-using-termin ...

  2. PHP——explode的应用(获取字符串,拆为下拉列表)

    <?php //定义有默认值的函数 function Main3($f=5,$g=6) { echo $f*$g; } Main3(2,3); echo "<br />&q ...

  3. 前端面试问题html汇总

    1.对WEB标准以及W3C的理解与认识 结构层 html :表示层  css:行为层:js; 标签闭合.标签小写.不乱嵌套.提高搜索机器人搜索机率.使用外链css和js脚本.结构行为表现的分离.文件下 ...

  4. linux下svn导入新目录到svn服务器特定地址

    svn import transplant-apps/ svn://xx.xx.xx.90/ -m "changelog:add transplant-apps to 90-svn" ...

  5. CH#56C 异象石

    一道LCA 原题链接 先跑一边\(dfs\),求出每个节点的时间戳,如果我们将有异象石的节点按时间戳从小到大的顺序排列,累加相邻两节点之间的距离(首尾相邻),会发现总和就是答案的两倍. 于是我们只需要 ...

  6. centos7 搭建vnc服务

  7. id不连续

    解决办法 Alter TABLE jf_day_pv_classify Drop id; Alter TABLE jf_day_pv_classify ADD id INT NOT NULL PRIM ...

  8. Tomcat+Redis+Nginx实现session共享(Windows版)

    redis安装:xx nginx安装:xx 步骤: 1.下载tomcat-redis-session-manager相应的jar包,主要有三个: wget https://github.com/dow ...

  9. python上下文管理协议

    所谓上下文管理协议,就是咱们打开文件时常用的一种方法:with __enter__(self):当with开始运行的时候触发此方法的运行 __exit__(self, exc_type, exc_va ...

  10. 【Apache】Apache服务的安装(一)

    Apache简介 Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行,由于其多平台和安全性被广泛使用,是最流行 ...