sitedown
v5.1.3
Sitedown將帶有Markdown Files的文件夾轉換為靜態HTML站點。
. build/
├─ README.md ==> ├─ index.html
├─ about.md ==> └─ about/
│ │ └─ index.html
│ │
├─ docs/ └─ docs/
│ ├─ README.md ==> │ ├─ index.html
│ └─ ref.md ==> │ └─ ref/
│ │ └─ index.html
│ │
└─ assets/ └─ assets/
└─ cat.jpg ==> └─ cat.jpg
它將所有標記文件列入當前文件夾(和子文件夾)中,並在build目錄中生成一個新站點。
README.md文件轉換為索引( index.html )。CHANGELOG.md => changelog/index.html )。layout.html )。assets文件夾的內容)。dev模式,並觀看更改以方便本地開發。Sitedown的網站是由Sitedown建造的,所以您知道這是真實的。
閱讀“使用”部分,以進行全面概述選項和默認值。
npm install sitedown
Usage: sitedown [source] [options]
Example: sitedown . -b dist -l layout.html
source path to source directory (default: current working directory)
--build, -b path to build directory (default: "build")
--pretty use directory indexes for pretty URLs (default: true)
--el, -e css selector for target element (default: ".markdown-body")
--layout, -l path to layout file
--github-headings, -g add anchors to headings just like GitHub (default: false)
--no-hljs-class don't add the hljs class to codeblocks (default: false)
--silent, -s make less noise during build
--watch, -w watch a directory or file (experimental)
--dev, -d start development server (experimental) (default: false)
--assets, -a assets folder to copy (default: "assets")
--version, -v show version information
--help, -h show help var sitedown = require ( 'sitedown' )
var options = {
source : '.' , // path to source directory default: cwd
build : 'build' , // path to build directory default: 'build' in cwd
pretty : true , // use directory indexes for pretty URLs default: true
el : '.markdown-body' , // css selector for target element default: '.markdown-body'
layout : 'layout.html' , // path to layout default: none
githubHeadings : false , // add anchors to headings just like GitHub default: false
noHljsClass : false , // don't add hljs class to codeblocks default: false
silent : false // make less noise during build default: false
}
sitedown ( options , function ( err ) {
if ( err ) return console . error ( err )
console . log ( 'success' )
} )所有文件都包裹在layout.html文件中。降價內容附加到第一個.markdown-body元素,並且頁面標題( <title> in <head>中的<title>)設置為第一個h1元素的文本。
默認佈局是:
<!DOCTYPE html >
< html lang =" en " >
< head >
< meta charset =" utf-8 " >
< meta name =" viewport " content =" width=device-width, initial-scale=1 " >
< title > </ title >
< link rel =" stylesheet " href =" https://unpkg.com/style.css " >
</ head >
< body >
< main class =" markdown-body " > </ main >
</ body >
</ html >默認佈局與style.css捆綁在一起,這是用於降價文檔的無類樣式表。
降價文件( $f.md , $f.markdown )被低估,並分解為$f/index.html文件。目錄索引可以使用pretty: false選項禁用。 README.md文件始終轉換為目錄索引( index.html )。
該指向Markdown文件( $f.md , $f.markdown )的相對鏈接被重寫為$f/ ,以指向其$f/index.html等效。
歡迎捐款!請先閱讀貢獻指南。
ISC
頁面圖像來自表情符號。