mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
Remove plugins
This commit is contained in:
parent
bbb540ce82
commit
8210a19dd3
@ -1,12 +1,16 @@
|
||||
# docsify [WIP]
|
||||
# docsify
|
||||
[](https://travis-ci.org/QingWei-Li/docsify)
|
||||
[](https://www.npmjs.com/package/docsify)
|
||||
|
||||
>🃏 A magical documentation site generator.
|
||||
|
||||
## CLI
|
||||
[https://github.com/QingWei-Li/docsify-cli](https://github.com/QingWei-Li/docsify-cli)
|
||||
|
||||
## Features
|
||||
- Easy and lightweight
|
||||
- Custom themes and plugins
|
||||
- Custom themes
|
||||
- No build
|
||||
|
||||
## Quick start
|
||||
Such as [./docs](https://github.com/QingWei-Li/docsify/tree/master/docs), Create `404.html` and `README.md` into `/docs`.
|
||||
|
||||
@ -46,7 +46,3 @@ build({
|
||||
plugins: [commonjs(), nodeResolve(), uglify()],
|
||||
inline: false
|
||||
})
|
||||
build({
|
||||
entry: 'plugins/nav.js',
|
||||
moduleName: 'Docsify.Nav'
|
||||
})
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
<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="//unpkg.com/docsify/themes/vue.css">
|
||||
<link rel="stylesheet" href="/themes/vue.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.pack.min.js"></script>
|
||||
<script src="/lib/docsify.pack.min.js" data-repo="qingwei-li/docsify"></script>
|
||||
</html>
|
||||
|
||||
@ -25,5 +25,11 @@ Such as [./docs](https://github.com/QingWei-Li/docsify/tree/master/docs), Create
|
||||
</html>
|
||||
```
|
||||
|
||||
```javascript
|
||||
import Vue from 'vue'
|
||||
|
||||
Vue.use(ElementUI)
|
||||
```
|
||||
|
||||
## License
|
||||
MIT
|
||||
|
||||
1
docs/themes
Symbolic link
1
docs/themes
Symbolic link
@ -0,0 +1 @@
|
||||
../themes
|
||||
@ -5,7 +5,16 @@ import bindEvent from './bind-event'
|
||||
const DEFAULT_OPTS = {
|
||||
el: '#app',
|
||||
title: document.title,
|
||||
sep: ' - '
|
||||
sep: ' - ',
|
||||
repo: ''
|
||||
}
|
||||
|
||||
const script = document.currentScript || [].slice.call(document.getElementsByTagName('script')).pop()
|
||||
|
||||
if (script) {
|
||||
for (const prop in DEFAULT_OPTS) {
|
||||
DEFAULT_OPTS[prop] = script.getAttribute('data-' + prop) || DEFAULT_OPTS[prop]
|
||||
}
|
||||
}
|
||||
|
||||
class Docsify {
|
||||
@ -39,17 +48,8 @@ class Docsify {
|
||||
}
|
||||
|
||||
render (content) {
|
||||
document.title = this.loc.slice(1) + this.opts.sep + this.opts.title
|
||||
this.dom[this.replace ? 'outerHTML' : 'innerHTML'] = render(content)
|
||||
}
|
||||
}
|
||||
|
||||
Docsify.use = function () {
|
||||
const plugin = arguments[0]
|
||||
if (typeof plugin === 'function') {
|
||||
plugin.call(Docsify)
|
||||
} else {
|
||||
throw TypeError('[docsify] Invalid plugin ' + plugin.name)
|
||||
document.title = this.loc.slice(1) + this.opts.title
|
||||
this.dom[this.replace ? 'outerHTML' : 'innerHTML'] = render(content, this.opts)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
const Nav = function () {
|
||||
console.log(this)
|
||||
}
|
||||
Nav.name = 'Doscify.Nav'
|
||||
|
||||
if (window.Docsify) {
|
||||
window.Docsify.use(Nav)
|
||||
}
|
||||
|
||||
export default Nav
|
||||
@ -2,6 +2,15 @@ import marked from 'marked'
|
||||
import Prism from 'prismjs'
|
||||
import genToc from './gen-toc'
|
||||
|
||||
const cornerTpl = `
|
||||
<a href="{{repo}}" class="github-corner" aria-label="View source on Github">
|
||||
<svg viewBox="0 0 250 250" aria-hidden="true">
|
||||
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
|
||||
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
|
||||
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
|
||||
</svg>
|
||||
</a>
|
||||
`
|
||||
const toc = []
|
||||
const renderer = new marked.Renderer()
|
||||
|
||||
@ -16,18 +25,27 @@ renderer.heading = function (text, level) {
|
||||
|
||||
return `<h${level} id="${slug}"><a href="#${slug}" class="anchor"></a>${text}</h${level}>`
|
||||
}
|
||||
marked.setOptions({
|
||||
renderer,
|
||||
highlight (code, lang) {
|
||||
return Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)
|
||||
}
|
||||
})
|
||||
|
||||
export default function (content) {
|
||||
// highlight code
|
||||
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>`
|
||||
}
|
||||
marked.setOptions({ renderer })
|
||||
|
||||
export default function (content, opts = {}) {
|
||||
let corner = ''
|
||||
|
||||
if (opts.repo) {
|
||||
const repo = /\/\//.test(opts.repo) ? opts.repo : ('https://github.com/' + opts.repo)
|
||||
corner = cornerTpl.replace(/{{repo}}/g, repo)
|
||||
}
|
||||
|
||||
const section = `<section class="content">
|
||||
<article class="markdown-section">${marked(content)}</article>
|
||||
</section>`
|
||||
const sidebar = `<aside class="sidebar">${genToc(toc)}</aside>`
|
||||
|
||||
return `<main>${sidebar}${section}</main>`
|
||||
return `${corner}<main>${sidebar}${section}</main>`
|
||||
}
|
||||
|
||||
104
themes/vue.css
104
themes/vue.css
@ -1,4 +1,4 @@
|
||||
@import url('https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600');
|
||||
s@import url('https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600');
|
||||
|
||||
* {
|
||||
-webkit-box-sizing: border-box;
|
||||
@ -11,6 +11,43 @@
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* github corner */
|
||||
.github-corner {
|
||||
display: block;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.github-corner svg {
|
||||
border: 0;
|
||||
color: #fff;
|
||||
fill: #42b983;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 80px;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.github-corner:hover .octo-arm {
|
||||
animation:octocat-wave 560ms ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes octocat-wave {
|
||||
0%,100%{ transform: rotate(0); }
|
||||
20%,60%{ transform: rotate(-25deg); }
|
||||
40%,80%{ transform: rotate(10deg); }
|
||||
}
|
||||
|
||||
@media (max-width: 500px) {
|
||||
.github-corner:hover .octo-arm {
|
||||
animation: none;
|
||||
}
|
||||
.github-corner .octo-arm {
|
||||
animation: octocat-wave 560ms ease-in-out;
|
||||
}
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
@ -97,7 +134,7 @@ main {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
@media screen(max-width: 600px) {
|
||||
@media screen and (max-width: 600px) {
|
||||
.sidebar {
|
||||
left: -300px;
|
||||
}
|
||||
@ -226,19 +263,18 @@ main {
|
||||
padding: 3px 5px;
|
||||
white-space: nowrap;
|
||||
font-size: 0.8em;
|
||||
font-family: 'Roboto Mono', Monaco, courier, monospace;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.markdown-section pre {
|
||||
padding: 1.2em 1.4em;
|
||||
line-height: 1.5em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.markdown-section code, .markdown-section pre {
|
||||
font-family: 'Roboto Mono', Monaco, courier, monospace;
|
||||
-webkit-font-smoothing: initial;
|
||||
-moz-osx-font-smoothing: initial;
|
||||
-webkit-font-smoothing: initial;
|
||||
background-color: #f8f8f8;
|
||||
line-height: 1.5em;
|
||||
margin: 1.2em 0;
|
||||
padding: 1.2em 1.4em;
|
||||
}
|
||||
|
||||
/* code highlight */
|
||||
@ -337,26 +373,6 @@ main {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
/* overrides color-values for the Line Numbers plugin
|
||||
* http://prismjs.com/plugins/line-numbers/
|
||||
*/
|
||||
.line-numbers .line-numbers-rows {
|
||||
border-right-color: #dfe2f1;
|
||||
}
|
||||
|
||||
.line-numbers-rows > span:before {
|
||||
color: #979db4;
|
||||
}
|
||||
|
||||
/* overrides color-values for the Line Highlight plugin
|
||||
* http://prismjs.com/plugins/line-highlight/
|
||||
*/
|
||||
.line-highlight {
|
||||
background: rgba(107, 115, 148, 0.2);
|
||||
background: -webkit-linear-gradient(left, rgba(107, 115, 148, 0.2) 70%, rgba(107, 115, 148, 0));
|
||||
background: linear-gradient(to right, rgba(107, 115, 148, 0.2) 70%, rgba(107, 115, 148, 0));
|
||||
}
|
||||
|
||||
.markdown-section pre>code {
|
||||
-moz-osx-font-smoothing: initial;
|
||||
-webkit-font-smoothing: initial;
|
||||
@ -372,8 +388,7 @@ main {
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
.markdown-section code:after, .markdown-section code:before {
|
||||
content: none;
|
||||
.markdown-section code::after, .markdown-section code::before {
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
@ -393,11 +408,9 @@ pre code {
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
pre code.lang-html:after,
|
||||
pre code.lang-js:after,
|
||||
pre code.lang-bash:after,
|
||||
pre code.lang-css:after {
|
||||
pre code::after {
|
||||
color: #ccc;
|
||||
content: attr(data-lang);
|
||||
font-size: 0.75em;
|
||||
font-weight: 600;
|
||||
height: 15px;
|
||||
@ -409,22 +422,6 @@ pre code.lang-css:after {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
pre code.lang-html:after {
|
||||
content: 'HTML';
|
||||
}
|
||||
|
||||
pre code.lang-js:after {
|
||||
content: 'JS';
|
||||
}
|
||||
|
||||
pre code.lang-bash:after {
|
||||
content: 'Shell';
|
||||
}
|
||||
|
||||
pre code.lang-css:after {
|
||||
content: 'CSS';
|
||||
}
|
||||
|
||||
.content img {
|
||||
max-width: 100%;
|
||||
}
|
||||
@ -440,8 +437,3 @@ pre code.lang-css:after {
|
||||
vertical-align: middle;
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
/* these aren't in gitbook at the moment, but leaving them in for future reference */
|
||||
img {
|
||||
border: none;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user