Compare commits

...
5 Commits
Author SHA1 Message Date
qingwei.li 4b961a9b69 -> v0.2.0 2016-11-26 18:52:48 +08:00
qingwei.li 2cf91da2f0 bump 2016-11-26 18:52:35 +08:00
qingwei.li 4f27fff283 Remove dynamic title 2016-11-26 18:51:44 +08:00
qingwei.li ff9e31f0c4 Add dev script 2016-11-26 18:37:17 +08:00
qingwei.li e8617a8af2 fix route 2016-11-26 18:13:39 +08:00
11 changed files with 49 additions and 23 deletions
+16
View File
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="/themes/vue.css">
</head>
<body>
<nav>
<a href="/">En</a>
<a href="/zh-cn">中文</a>
</nav>
<div id="app"></div>
</body>
<script src="/lib/docsify.js" data-repo="qingwei-li/docsify"></script>
</html>
+5
View File
@@ -30,5 +30,10 @@ Create `404.html` and `README.md` into `/docs`.
</html>
```
## How to contribute
- Fork it and clone!
- Run `npm i && npm run dev`
## License
MIT
+14
View File
@@ -0,0 +1,14 @@
var serveStatic = require('serve-static')
var http = require('http')
var fs = require('fs')
var notfound = fs.readFileSync('404.dev.html')
http.createServer(function (req, res) {
serveStatic('.')(req, res, function () {
res.writeHead(404, { 'Content-Type': 'text/html' })
res.end(notfound)
})
}).listen(3000)
console.log(`\nListening at http://localhost:3000\n`)
+2 -2
View File
@@ -23,12 +23,12 @@ var build = function (opts) {
}
build({
entry: 'docsify.js',
entry: 'index.js',
output: 'docsify.js',
plugins: [commonjs(), nodeResolve()]
})
build({
entry: 'docsify.js',
entry: 'index.js',
output: 'docsify.min.js',
plugins: [commonjs(), nodeResolve(), uglify()]
})
+2 -2
View File
@@ -9,8 +9,8 @@
</head>
<body>
<nav>
<a href="/">En</a>
<a href="/zh-cn">中文</a>
<a href="/docsify/">En</a>
<a href="/docsify/zh-cn">中文</a>
</nav>
<div id="app"></div>
</body>
+2 -2
View File
@@ -86,8 +86,8 @@ Code in `404.html`
```html
<nav>
<a href="/">En</a>
<a href="/zh-cn">中文</a>
<a href="/docsify/">En</a>
<a href="/docsify/zh-cn">中文</a>
</nav>
```
+2 -2
View File
@@ -85,8 +85,8 @@ docsify serve docs
```html
<nav>
<a href="/">En</a>
<a href="/zh-cn">中文</a>
<a href="/docsify/">En</a>
<a href="/docsify/zh-cn">中文</a>
</nav>
```
-6
View File
@@ -2249,8 +2249,6 @@ var bindEvent = function () {
var DEFAULT_OPTS = {
el: '#app',
title: document.title,
sep: ' - ',
repo: ''
};
@@ -2266,7 +2264,6 @@ var Docsify = function Docsify (opts) {
Docsify.installed = true;
this.opts = Object.assign({}, opts, DEFAULT_OPTS);
this.opts.title = (this.opts.title ? this.opts.sep : '') + this.opts.title;
this.replace = true;
this.dom = document.querySelector(this.opts.el);
@@ -2297,9 +2294,6 @@ Docsify.prototype.load = function load () {
};
Docsify.prototype.render = function render$1 (content) {
if (this.loc.slice(1) !== 'README') {
document.title = this.loc.slice(1) + this.opts.title;
}
this.dom[this.replace ? 'outerHTML' : 'innerHTML'] = render(content, this.opts);
};
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -2
View File
@@ -1,6 +1,6 @@
{
"name": "docsify",
"version": "0.1.0",
"version": "0.2.0",
"description": "A magical documentation generator.",
"main": "lib/docsify.js",
"files": [
@@ -10,6 +10,7 @@
],
"scripts": {
"build": "node build/build.js",
"dev": "node app.js & nodemon --watch src themes --exec 'npm run build'",
"test": "eslint src test"
},
"repository": {
@@ -30,11 +31,13 @@
"eslint": "^3.10.2",
"eslint-config-vue": "^2.0.1",
"eslint-plugin-vue": "^1.0.0",
"nodemon": "^1.11.0",
"rollup": "^0.36.3",
"rollup-plugin-buble": "^0.14.0",
"rollup-plugin-commonjs": "^5.0.5",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1"
"rollup-plugin-uglify": "^1.0.1",
"serve-static": "^1.11.1"
},
"dependencies": {
"marked": "^0.3.6",
-6
View File
@@ -4,8 +4,6 @@ import bindEvent from './bind-event'
const DEFAULT_OPTS = {
el: '#app',
title: document.title,
sep: ' - ',
repo: ''
}
@@ -22,7 +20,6 @@ class Docsify {
Docsify.installed = true
this.opts = Object.assign({}, opts, DEFAULT_OPTS)
this.opts.title = (this.opts.title ? this.opts.sep : '') + this.opts.title
this.replace = true
this.dom = document.querySelector(this.opts.el)
@@ -51,9 +48,6 @@ class Docsify {
}
render (content) {
if (this.loc.slice(1) !== 'README') {
document.title = this.loc.slice(1) + this.opts.title
}
this.dom[this.replace ? 'outerHTML' : 'innerHTML'] = render(content, this.opts)
}