將markdown格式轉化為bootstrap風格html

來源:互聯網
上載者:User

前言:這些年markdown格式的檔案非常流行,像github裡project說明文檔都是用markdown格式編寫。

一方面,我們可以通過pandoc將markdown檔案轉換為html,這樣將html檔案放到自己的伺服器上就可以解釋了。安裝pandoc見我的GitHub連結。

另一方面,bootstrap是近年來一個比較好的web前端架構,那麼我們希望將markdown檔案轉換為bootstrap風格的html檔案。已經有人做過這個模組markdown2bootstrap。

1. 安裝nodejs及npm

sudo apt-get install npmsudo apt-get install nodejssudo ln -s /usr/bin/nodejs /usr/bin/node
其中第三行是做一個連結,不然可能會遇到如下error
/usr/bin/env: node: No such file or directory
2. 安裝markdown2bootstrap到目前的目錄下
 npm install markdown2bootstrap
如果你電腦是代理上網的話,在使用以上命令之前得設定npm的代理,如下格式
npm config set proxy=http://175.186.53.20:3128
3. 將markdown轉換為html命令
 ./node_modules/.bin/markdown2bootstrap index.md 
如果不想產生數字列表用-n參數
./node_modules/.bin/markdown2bootstrap -n index.md
4.最後一步將包拷到你的網站根目錄下,我的是 ~/www
cp -r node_modules/markdown2bootstrap/bootstrap ~/www
這樣你的html檔案放在你的網站上才會正確解釋。

介面風格如下:

我的OS是Ubuntu 14.04

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.