mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-10 13:56:12 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e789fb2b18 | ||
|
|
6e4b9d4cad | ||
|
|
824e64ae48 | ||
|
|
4b961a9b69 | ||
|
|
2cf91da2f0 | ||
|
|
4f27fff283 | ||
|
|
ff9e31f0c4 | ||
|
|
e8617a8af2 |
@@ -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/buble.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>
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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>
|
||||
```
|
||||
|
||||
|
||||
+1
-7
@@ -2175,7 +2175,7 @@ renderer.heading = function (text, level) {
|
||||
renderer.code = function (code, lang) {
|
||||
var hl = prism.highlight(code, prism.languages[lang] || prism.languages.markup);
|
||||
|
||||
return ("<pre><code class=\"lang-" + lang + "\" data-lang=\"" + lang + "\">" + hl + "</code></pre>")
|
||||
return ("<pre data-lang=\"" + lang + "\"><code class=\"lang-" + lang + "\">" + hl + "</code></pre>")
|
||||
};
|
||||
marked.setOptions({ renderer: renderer });
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+5
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.1",
|
||||
"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",
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ renderer.heading = function (text, level) {
|
||||
renderer.code = function (code, lang) {
|
||||
const hl = Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)
|
||||
|
||||
return `<pre><code class="lang-${lang}" data-lang="${lang}">${hl}</code></pre>`
|
||||
return `<pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
|
||||
}
|
||||
marked.setOptions({ renderer })
|
||||
|
||||
|
||||
+2
-1
@@ -362,9 +362,10 @@ main {
|
||||
}
|
||||
|
||||
.markdown-section pre>code {
|
||||
padding: 0;
|
||||
display: block;
|
||||
font-family: Inconsolata;
|
||||
line-height: 1.2em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.markdown-section code::after, .markdown-section code::before {
|
||||
|
||||
+3
-3
@@ -283,13 +283,14 @@ main {
|
||||
}
|
||||
|
||||
.markdown-section pre {
|
||||
font-family: 'Roboto Mono', Monaco, courier, monospace;
|
||||
-moz-osx-font-smoothing: initial;
|
||||
-webkit-font-smoothing: initial;
|
||||
background-color: #f8f8f8;
|
||||
font-family: 'Roboto Mono', Monaco, courier, monospace;
|
||||
line-height: 1.5em;
|
||||
margin: 1.2em 0;
|
||||
padding: 1.2em 1.4em;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* code highlight */
|
||||
@@ -415,7 +416,6 @@ code .token {
|
||||
|
||||
pre code {
|
||||
overflow-x: auto;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
background-color: #f8f8f8;
|
||||
padding: 0.8em 0.8em 0.4em;
|
||||
@@ -423,7 +423,7 @@ pre code {
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
pre code::after {
|
||||
pre::after {
|
||||
color: #ccc;
|
||||
content: attr(data-lang);
|
||||
font-size: 0.75em;
|
||||
|
||||
Reference in New Issue
Block a user