chore: prettier code
This commit is contained in:
parent
a9704b5156
commit
aba2aec0d0
30 changed files with 1533 additions and 734 deletions
10
app.js
10
app.js
|
|
@ -30,13 +30,15 @@ var renderer = new Renderer({
|
||||||
alias: {
|
alias: {
|
||||||
'/de-de/changelog': '/changelog',
|
'/de-de/changelog': '/changelog',
|
||||||
'/zh-cn/changelog': '/changelog',
|
'/zh-cn/changelog': '/changelog',
|
||||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
'/changelog':
|
||||||
|
'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
path: './'
|
path: './'
|
||||||
})
|
})
|
||||||
|
|
||||||
http.createServer(function (req, res) {
|
http
|
||||||
|
.createServer(function (req, res) {
|
||||||
serveStatic('.')(req, res, function () {
|
serveStatic('.')(req, res, function () {
|
||||||
// TEST SSR
|
// TEST SSR
|
||||||
// renderer.renderToString(req.url)
|
// renderer.renderToString(req.url)
|
||||||
|
|
@ -45,7 +47,7 @@ http.createServer(function (req, res) {
|
||||||
res.writeHead(404, { 'Content-Type': 'text/html' })
|
res.writeHead(404, { 'Content-Type': 'text/html' })
|
||||||
res.end(fs.readFileSync('dev.html'))
|
res.end(fs.readFileSync('dev.html'))
|
||||||
})
|
})
|
||||||
}).listen(3000, '0.0.0.0')
|
})
|
||||||
|
.listen(3000, '0.0.0.0')
|
||||||
|
|
||||||
console.log(`\nListening at http://0.0.0.0:3000\n`)
|
console.log(`\nListening at http://0.0.0.0:3000\n`)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,8 @@ var file = __dirname + '/../docs/_coverpage.md'
|
||||||
var cover = read(file, 'utf8').toString()
|
var cover = read(file, 'utf8').toString()
|
||||||
|
|
||||||
console.log('Replace version number in cover page...')
|
console.log('Replace version number in cover page...')
|
||||||
cover = cover.replace(/<small>(\S+)?<\/small>/g, '<small>' + version + '</small>')
|
cover = cover.replace(
|
||||||
|
/<small>(\S+)?<\/small>/g,
|
||||||
|
'<small>' + version + '</small>'
|
||||||
|
)
|
||||||
write(file, cover)
|
write(file, cover)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ var resolve = require('path').resolve
|
||||||
var postcss = require('postcss')
|
var postcss = require('postcss')
|
||||||
var isProd = process.argv[process.argv.length - 1] !== '--dev'
|
var isProd = process.argv[process.argv.length - 1] !== '--dev'
|
||||||
|
|
||||||
var processor = postcss([require('postcss-salad')({
|
var processor = postcss([
|
||||||
|
require('postcss-salad')({
|
||||||
features: {
|
features: {
|
||||||
precss: {
|
precss: {
|
||||||
properties: {
|
properties: {
|
||||||
|
|
@ -12,7 +13,8 @@ var processor = postcss([require('postcss-salad')({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})])
|
})
|
||||||
|
])
|
||||||
|
|
||||||
var saveMin = function (file, content) {
|
var saveMin = function (file, content) {
|
||||||
fs.writeFileSync(resolve(__dirname, '../lib/themes/', file), content)
|
fs.writeFileSync(resolve(__dirname, '../lib/themes/', file), content)
|
||||||
|
|
@ -31,17 +33,18 @@ var list = fs.readdirSync(resolve(__dirname, '../src/themes'))
|
||||||
|
|
||||||
list.forEach(function (file) {
|
list.forEach(function (file) {
|
||||||
if (!/\.css$/.test(file)) return
|
if (!/\.css$/.test(file)) return
|
||||||
processor.process(load(file), { from: resolve(__dirname, '../src/themes/', file) })
|
processor
|
||||||
|
.process(load(file), { from: resolve(__dirname, '../src/themes/', file) })
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
save(file, result.css)
|
save(file, result.css)
|
||||||
console.log('salad - ' + file)
|
console.log('salad - ' + file)
|
||||||
isProd && cssnano(loadLib(file))
|
isProd &&
|
||||||
.then(function (result) {
|
cssnano(loadLib(file)).then(function (result) {
|
||||||
saveMin(file, result.css)
|
saveMin(file, result.css)
|
||||||
console.log('cssnao - ' + file)
|
console.log('cssnao - ' + file)
|
||||||
})
|
})
|
||||||
}).catch(function (err) {
|
})
|
||||||
|
.catch(function (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ function cwd (...args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mainTpl (config) {
|
function mainTpl (config) {
|
||||||
let html = `<nav class="app-nav${config.repo ? '' : ' no-badge'}"><!--navbar--></nav>`
|
let html = `<nav class="app-nav${config.repo
|
||||||
|
? ''
|
||||||
|
: ' no-badge'}"><!--navbar--></nav>`
|
||||||
|
|
||||||
if (config.repo) {
|
if (config.repo) {
|
||||||
html += tpl.corner(config.repo)
|
html += tpl.corner(config.repo)
|
||||||
|
|
@ -28,11 +30,7 @@ function mainTpl (config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Renderer {
|
export default class Renderer {
|
||||||
constructor ({
|
constructor ({ template, config, cache }) {
|
||||||
template,
|
|
||||||
config,
|
|
||||||
cache
|
|
||||||
}) {
|
|
||||||
this.html = template
|
this.html = template
|
||||||
this.config = config = Object.assign({}, config, {
|
this.config = config = Object.assign({}, config, {
|
||||||
routerMode: 'history'
|
routerMode: 'history'
|
||||||
|
|
@ -43,7 +41,10 @@ export default class Renderer {
|
||||||
this.compiler = new Compiler(config, this.router)
|
this.compiler = new Compiler(config, this.router)
|
||||||
|
|
||||||
this.router.getCurrentPath = () => this.url
|
this.router.getCurrentPath = () => this.url
|
||||||
this._renderHtml('inject-config', `<script>window.$docsify = ${JSON.stringify(config)}</script>`)
|
this._renderHtml(
|
||||||
|
'inject-config',
|
||||||
|
`<script>window.$docsify = ${JSON.stringify(config)}</script>`
|
||||||
|
)
|
||||||
this._renderHtml('inject-app', mainTpl(config))
|
this._renderHtml('inject-app', mainTpl(config))
|
||||||
|
|
||||||
this.template = this.html
|
this.template = this.html
|
||||||
|
|
@ -52,9 +53,7 @@ export default class Renderer {
|
||||||
_getPath (url) {
|
_getPath (url) {
|
||||||
const file = this.router.getFile(url)
|
const file = this.router.getFile(url)
|
||||||
|
|
||||||
return isAbsolutePath(file)
|
return isAbsolutePath(file) ? file : cwd(`./${file}`)
|
||||||
? file
|
|
||||||
: cwd(`./${file}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async renderToString (url) {
|
async renderToString (url) {
|
||||||
|
|
@ -94,7 +93,8 @@ export default class Renderer {
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'sidebar':
|
case 'sidebar':
|
||||||
html = this.compiler.sidebar(html, maxLevel) +
|
html =
|
||||||
|
this.compiler.sidebar(html, maxLevel) +
|
||||||
`<script>window.__SUB_SIDEBAR__ = ${JSON.stringify(
|
`<script>window.__SUB_SIDEBAR__ = ${JSON.stringify(
|
||||||
this.compiler.subSidebar(subMaxLevel)
|
this.compiler.subSidebar(subMaxLevel)
|
||||||
)}</script>`
|
)}</script>`
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { merge, hyphenate, isPrimitive } from './util/core'
|
import { merge, hyphenate, isPrimitive } from './util/core'
|
||||||
|
|
||||||
const config = merge({
|
const config = merge(
|
||||||
|
{
|
||||||
el: '#app',
|
el: '#app',
|
||||||
repo: '',
|
repo: '',
|
||||||
maxLevel: 6,
|
maxLevel: 6,
|
||||||
|
|
@ -23,10 +24,14 @@ const config = merge({
|
||||||
externalLinkTarget: '_blank',
|
externalLinkTarget: '_blank',
|
||||||
routerMode: 'hash',
|
routerMode: 'hash',
|
||||||
noCompileLinks: []
|
noCompileLinks: []
|
||||||
}, window.$docsify)
|
},
|
||||||
|
window.$docsify
|
||||||
|
)
|
||||||
|
|
||||||
const script = document.currentScript ||
|
const script =
|
||||||
[].slice.call(document.getElementsByTagName('script'))
|
document.currentScript ||
|
||||||
|
[].slice
|
||||||
|
.call(document.getElementsByTagName('script'))
|
||||||
.filter(n => /docsify\./.test(n.src))[0]
|
.filter(n => /docsify\./.test(n.src))[0]
|
||||||
|
|
||||||
if (script) {
|
if (script) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ function scrollTo (el) {
|
||||||
duration: 500
|
duration: 500
|
||||||
})
|
})
|
||||||
.on('tick', v => window.scrollTo(0, v))
|
.on('tick', v => window.scrollTo(0, v))
|
||||||
.on('done', () => { enableScrollEvent = true; scroller = null })
|
.on('done', () => {
|
||||||
|
enableScrollEvent = true
|
||||||
|
scroller = null
|
||||||
|
})
|
||||||
.begin()
|
.begin()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,7 +31,7 @@ function highlight () {
|
||||||
const wrap = dom.find(sidebar, '.sidebar-nav')
|
const wrap = dom.find(sidebar, '.sidebar-nav')
|
||||||
let active = dom.find(sidebar, 'li.active')
|
let active = dom.find(sidebar, 'li.active')
|
||||||
const doc = document.documentElement
|
const doc = document.documentElement
|
||||||
const top = (doc && doc.scrollTop || document.body.scrollTop) - coverHeight
|
const top = ((doc && doc.scrollTop) || document.body.scrollTop) - coverHeight
|
||||||
let last
|
let last
|
||||||
|
|
||||||
for (let i = 0, len = anchors.length; i < len; i += 1) {
|
for (let i = 0, len = anchors.length; i < len; i += 1) {
|
||||||
|
|
@ -56,16 +59,10 @@ function highlight () {
|
||||||
const height = sidebar.clientHeight
|
const height = sidebar.clientHeight
|
||||||
const curOffset = 0
|
const curOffset = 0
|
||||||
const cur = active.offsetTop + active.clientHeight + 40
|
const cur = active.offsetTop + active.clientHeight + 40
|
||||||
const isInView = (
|
const isInView =
|
||||||
active.offsetTop >= wrap.scrollTop &&
|
active.offsetTop >= wrap.scrollTop && cur <= wrap.scrollTop + height
|
||||||
cur <= wrap.scrollTop + height
|
|
||||||
)
|
|
||||||
const notThan = cur - curOffset < height
|
const notThan = cur - curOffset < height
|
||||||
const top = isInView
|
const top = isInView ? wrap.scrollTop : notThan ? curOffset : cur - height
|
||||||
? wrap.scrollTop
|
|
||||||
: notThan
|
|
||||||
? curOffset
|
|
||||||
: cur - height
|
|
||||||
|
|
||||||
sidebar.scrollTop = top
|
sidebar.scrollTop = top
|
||||||
}
|
}
|
||||||
|
|
@ -95,8 +92,12 @@ export function scrollActiveSidebar (router) {
|
||||||
|
|
||||||
dom.off('scroll', highlight)
|
dom.off('scroll', highlight)
|
||||||
dom.on('scroll', highlight)
|
dom.on('scroll', highlight)
|
||||||
dom.on(sidebar, 'mouseover', () => { hoverOver = true })
|
dom.on(sidebar, 'mouseover', () => {
|
||||||
dom.on(sidebar, 'mouseleave', () => { hoverOver = false })
|
hoverOver = true
|
||||||
|
})
|
||||||
|
dom.on(sidebar, 'mouseleave', () => {
|
||||||
|
hoverOver = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function scrollIntoView (id) {
|
export function scrollIntoView (id) {
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,11 @@ export function btn (el, router) {
|
||||||
|
|
||||||
const sidebar = dom.getNode('.sidebar')
|
const sidebar = dom.getNode('.sidebar')
|
||||||
|
|
||||||
isMobile && dom.on(dom.body, 'click', _ =>
|
isMobile &&
|
||||||
dom.body.classList.contains('close') && toggle()
|
dom.on(
|
||||||
|
dom.body,
|
||||||
|
'click',
|
||||||
|
_ => dom.body.classList.contains('close') && toggle()
|
||||||
)
|
)
|
||||||
dom.on(sidebar, 'click', _ =>
|
dom.on(sidebar, 'click', _ =>
|
||||||
setTimeout((_ => getAndActive(router, sidebar, true, true), 0))
|
setTimeout((_ => getAndActive(router, sidebar, true, true), 0))
|
||||||
|
|
@ -51,9 +54,7 @@ export function getAndActive (router, el, isParent, autoTitle) {
|
||||||
const hash = router.toURL(router.getCurrentPath())
|
const hash = router.toURL(router.getCurrentPath())
|
||||||
let target
|
let target
|
||||||
|
|
||||||
links
|
links.sort((a, b) => b.href.length - a.href.length).forEach(a => {
|
||||||
.sort((a, b) => b.href.length - a.href.length)
|
|
||||||
.forEach(a => {
|
|
||||||
const href = a.getAttribute('href')
|
const href = a.getAttribute('href')
|
||||||
const node = isParent ? a.parentNode : a
|
const node = isParent ? a.parentNode : a
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,13 @@ export function get (url, hasBar = false) {
|
||||||
return {
|
return {
|
||||||
then: function (success, error = noop) {
|
then: function (success, error = noop) {
|
||||||
if (hasBar) {
|
if (hasBar) {
|
||||||
const id = setInterval(_ => progressbar({
|
const id = setInterval(
|
||||||
|
_ =>
|
||||||
|
progressbar({
|
||||||
step: Math.floor(Math.random() * 5 + 1)
|
step: Math.floor(Math.random() * 5 + 1)
|
||||||
}), 500)
|
}),
|
||||||
|
500
|
||||||
|
)
|
||||||
|
|
||||||
on('progress', progressbar)
|
on('progress', progressbar)
|
||||||
on('loadend', evt => {
|
on('loadend', evt => {
|
||||||
|
|
@ -42,12 +46,12 @@ export function get (url, hasBar = false) {
|
||||||
if (target.status >= 400) {
|
if (target.status >= 400) {
|
||||||
error(target)
|
error(target)
|
||||||
} else {
|
} else {
|
||||||
const result = cache[url] = {
|
const result = (cache[url] = {
|
||||||
content: target.response,
|
content: target.response,
|
||||||
opt: {
|
opt: {
|
||||||
updatedAt: xhr.getResponseHeader('last-modified')
|
updatedAt: xhr.getResponseHeader('last-modified')
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
success(result.content, result.opt)
|
success(result.content, result.opt)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ export function initLifecycle (vm) {
|
||||||
vm._hooks = {}
|
vm._hooks = {}
|
||||||
vm._lifecycle = {}
|
vm._lifecycle = {}
|
||||||
hooks.forEach(hook => {
|
hooks.forEach(hook => {
|
||||||
const arr = vm._hooks[hook] = []
|
const arr = (vm._hooks[hook] = [])
|
||||||
vm._lifecycle[hook] = fn => arr.push(fn)
|
vm._lifecycle[hook] = fn => arr.push(fn)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ const re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g
|
||||||
export function slugify (str) {
|
export function slugify (str) {
|
||||||
if (typeof str !== 'string') return ''
|
if (typeof str !== 'string') return ''
|
||||||
|
|
||||||
let slug = str.toLowerCase().trim()
|
let slug = str
|
||||||
|
.toLowerCase()
|
||||||
|
.trim()
|
||||||
.replace(/<[^>\d]+>/g, '')
|
.replace(/<[^>\d]+>/g, '')
|
||||||
.replace(re, '')
|
.replace(re, '')
|
||||||
.replace(/\s/g, '-')
|
.replace(/\s/g, '-')
|
||||||
|
|
@ -12,7 +14,7 @@ export function slugify (str) {
|
||||||
.replace(/^(\d)/, '_$1')
|
.replace(/^(\d)/, '_$1')
|
||||||
let count = cache[slug]
|
let count = cache[slug]
|
||||||
|
|
||||||
count = cache.hasOwnProperty(slug) ? (count + 1) : 0
|
count = cache.hasOwnProperty(slug) ? count + 1 : 0
|
||||||
cache[slug] = count
|
cache[slug] = count
|
||||||
|
|
||||||
if (count) {
|
if (count) {
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,15 @@ export function corner (data) {
|
||||||
'<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="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>' +
|
'<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>' +
|
'</svg>' +
|
||||||
'</a>')
|
'</a>'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render main content
|
* Render main content
|
||||||
*/
|
*/
|
||||||
export function main (config) {
|
export function main (config) {
|
||||||
const aside = (
|
const aside =
|
||||||
'<button class="sidebar-toggle">' +
|
'<button class="sidebar-toggle">' +
|
||||||
'<div class="sidebar-toggle-button">' +
|
'<div class="sidebar-toggle-button">' +
|
||||||
'<span></span><span></span><span></span>' +
|
'<span></span><span></span><span></span>' +
|
||||||
|
|
@ -34,13 +35,15 @@ export function main (config) {
|
||||||
? `<h1><a class="app-name-link" data-nosearch>${config.name}</a></h1>`
|
? `<h1><a class="app-name-link" data-nosearch>${config.name}</a></h1>`
|
||||||
: '') +
|
: '') +
|
||||||
'<div class="sidebar-nav"><!--sidebar--></div>' +
|
'<div class="sidebar-nav"><!--sidebar--></div>' +
|
||||||
'</aside>')
|
'</aside>'
|
||||||
|
|
||||||
return (isMobile ? `${aside}<main>` : `<main>${aside}`) +
|
return (
|
||||||
|
(isMobile ? `${aside}<main>` : `<main>${aside}`) +
|
||||||
'<section class="content">' +
|
'<section class="content">' +
|
||||||
'<article class="markdown-section" id="main"><!--main--></article>' +
|
'<article class="markdown-section" id="main"><!--main--></article>' +
|
||||||
'</section>' +
|
'</section>' +
|
||||||
'</main>'
|
'</main>'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -48,14 +51,17 @@ export function main (config) {
|
||||||
*/
|
*/
|
||||||
export function cover () {
|
export function cover () {
|
||||||
const SL = ', 100%, 85%'
|
const SL = ', 100%, 85%'
|
||||||
const bgc = 'linear-gradient(to left bottom, ' +
|
const bgc =
|
||||||
|
'linear-gradient(to left bottom, ' +
|
||||||
`hsl(${Math.floor(Math.random() * 255) + SL}) 0%,` +
|
`hsl(${Math.floor(Math.random() * 255) + SL}) 0%,` +
|
||||||
`hsl(${Math.floor(Math.random() * 255) + SL}) 100%)`
|
`hsl(${Math.floor(Math.random() * 255) + SL}) 100%)`
|
||||||
|
|
||||||
return `<section class="cover" style="background: ${bgc}">` +
|
return (
|
||||||
|
`<section class="cover" style="background: ${bgc}">` +
|
||||||
'<div class="cover-main"></div>' +
|
'<div class="cover-main"></div>' +
|
||||||
'<div class="mask"></div>' +
|
'<div class="mask"></div>' +
|
||||||
'</section>'
|
'</section>'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,20 @@ import { noop } from '../../util/core'
|
||||||
const cached = {}
|
const cached = {}
|
||||||
|
|
||||||
function getAlias (path, alias, last) {
|
function getAlias (path, alias, last) {
|
||||||
const match = Object.keys(alias).filter((key) => {
|
const match = Object.keys(alias).filter(key => {
|
||||||
const re = cached[key] || (cached[key] = new RegExp(`^${key}$`))
|
const re = cached[key] || (cached[key] = new RegExp(`^${key}$`))
|
||||||
return re.test(path) && path !== last
|
return re.test(path) && path !== last
|
||||||
})[0]
|
})[0]
|
||||||
|
|
||||||
return match ? getAlias(path.replace(cached[match], alias[match]), alias, path) : path
|
return match
|
||||||
|
? getAlias(path.replace(cached[match], alias[match]), alias, path)
|
||||||
|
: path
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFileName (path) {
|
function getFileName (path) {
|
||||||
return /\.(md|html)$/g.test(path)
|
return /\.(md|html)$/g.test(path)
|
||||||
? path
|
? path
|
||||||
: /\/$/g.test(path)
|
: /\/$/g.test(path) ? `${path}README.md` : `${path}.md`
|
||||||
? `${path}README.md`
|
|
||||||
: `${path}.md`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class History {
|
export class History {
|
||||||
|
|
@ -37,7 +37,7 @@ export class History {
|
||||||
|
|
||||||
path = config.alias ? getAlias(path, config.alias) : path
|
path = config.alias ? getAlias(path, config.alias) : path
|
||||||
path = getFileName(path)
|
path = getFileName(path)
|
||||||
path = path === '/README.md' ? (config.homepage || path) : path
|
path = path === '/README.md' ? config.homepage || path : path
|
||||||
path = isAbsolutePath(path) ? path : getPath(base, path)
|
path = isAbsolutePath(path) ? path : getPath(base, path)
|
||||||
|
|
||||||
if (isRelative) {
|
if (isRelative) {
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,7 @@ import { parseQuery, stringifyQuery, cleanPath } from '../util'
|
||||||
|
|
||||||
function replaceHash (path) {
|
function replaceHash (path) {
|
||||||
const i = location.href.indexOf('#')
|
const i = location.href.indexOf('#')
|
||||||
location.replace(
|
location.replace(location.href.slice(0, i >= 0 ? i : 0) + '#' + path)
|
||||||
location.href.slice(0, i >= 0 ? i : 0) + '#' + path
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const replaceSlug = cached(path => {
|
const replaceSlug = cached(path => {
|
||||||
|
|
@ -24,9 +22,7 @@ export class HashHistory extends History {
|
||||||
const path = window.location.pathname || ''
|
const path = window.location.pathname || ''
|
||||||
const base = this.config.basePath
|
const base = this.config.basePath
|
||||||
|
|
||||||
return /^(\/|https?:)/g.test(base)
|
return /^(\/|https?:)/g.test(base) ? base : cleanPath(path + '/' + base)
|
||||||
? base
|
|
||||||
: cleanPath(path + '/' + base)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentPath () {
|
getCurrentPath () {
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,7 @@ export class HTML5History extends History {
|
||||||
|
|
||||||
onchange (cb = noop) {
|
onchange (cb = noop) {
|
||||||
on('click', e => {
|
on('click', e => {
|
||||||
const el = e.target.tagName === 'A'
|
const el = e.target.tagName === 'A' ? e.target : e.target.parentNode
|
||||||
? e.target
|
|
||||||
: e.target.parentNode
|
|
||||||
|
|
||||||
if (el.tagName === 'A' && !/_blank/.test(el.target)) {
|
if (el.tagName === 'A' && !/_blank/.test(el.target)) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,11 @@ export function stringifyQuery (obj) {
|
||||||
const qs = []
|
const qs = []
|
||||||
|
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
qs.push(obj[key]
|
qs.push(
|
||||||
|
obj[key]
|
||||||
? `${encode(key)}=${encode(obj[key])}`.toLowerCase()
|
? `${encode(key)}=${encode(obj[key])}`.toLowerCase()
|
||||||
: encode(key))
|
: encode(key)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return qs.length ? `?${qs.join('&')}` : ''
|
return qs.length ? `?${qs.join('&')}` : ''
|
||||||
|
|
@ -45,13 +47,9 @@ export const isAbsolutePath = cached(path => {
|
||||||
export const getParentPath = cached(path => {
|
export const getParentPath = cached(path => {
|
||||||
return /\/$/g.test(path)
|
return /\/$/g.test(path)
|
||||||
? path
|
? path
|
||||||
: (path = path.match(/(\S*\/)[^\/]+$/))
|
: (path = path.match(/(\S*\/)[^\/]+$/)) ? path[1] : ''
|
||||||
? path[1]
|
|
||||||
: ''
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export const cleanPath = cached(path => {
|
export const cleanPath = cached(path => {
|
||||||
return path
|
return path.replace(/^\/+/, '/').replace(/([^:])\/{2,}/g, '$1/')
|
||||||
.replace(/^\/+/, '/')
|
|
||||||
.replace(/([^:])\/{2,}/g, '$1/')
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ export const hyphenate = cached(str => {
|
||||||
/**
|
/**
|
||||||
* Simple Object.assign polyfill
|
* Simple Object.assign polyfill
|
||||||
*/
|
*/
|
||||||
export const merge = Object.assign || function (to) {
|
export const merge =
|
||||||
|
Object.assign ||
|
||||||
|
function (to) {
|
||||||
const hasOwn = Object.prototype.hasOwnProperty
|
const hasOwn = Object.prototype.hasOwnProperty
|
||||||
|
|
||||||
for (let i = 1; i < arguments.length; i++) {
|
for (let i = 1; i < arguments.length; i++) {
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,17 @@ export const isMobile = inBrowser && document.body.clientWidth <= 600
|
||||||
/**
|
/**
|
||||||
* @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js
|
* @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js
|
||||||
*/
|
*/
|
||||||
export const supportsPushState = inBrowser && (function () {
|
export const supportsPushState =
|
||||||
|
inBrowser &&
|
||||||
|
(function () {
|
||||||
// Borrowed wholesale from https://github.com/defunkt/jquery-pjax
|
// Borrowed wholesale from https://github.com/defunkt/jquery-pjax
|
||||||
return window.history &&
|
return (
|
||||||
|
window.history &&
|
||||||
window.history.pushState &&
|
window.history.pushState &&
|
||||||
window.history.replaceState &&
|
window.history.replaceState &&
|
||||||
// pushState isn’t reliable on iOS until 5.
|
// pushState isn’t reliable on iOS until 5.
|
||||||
!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/)
|
!navigator.userAgent.match(
|
||||||
|
/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/
|
||||||
|
)
|
||||||
|
)
|
||||||
})()
|
})()
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,17 @@ import * as dom from '../dom'
|
||||||
import { get } from '../../fetch/ajax'
|
import { get } from '../../fetch/ajax'
|
||||||
|
|
||||||
function replaceVar (block, color) {
|
function replaceVar (block, color) {
|
||||||
block.innerHTML = block.innerHTML
|
block.innerHTML = block.innerHTML.replace(
|
||||||
.replace(/var\(\s*--theme-color.*?\)/g, color)
|
/var\(\s*--theme-color.*?\)/g,
|
||||||
|
color
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (color) {
|
export default function (color) {
|
||||||
// Variable support
|
// Variable support
|
||||||
if (window.CSS &&
|
if (window.CSS && window.CSS.supports && window.CSS.supports('(--v:red)')) { return }
|
||||||
window.CSS.supports &&
|
|
||||||
window.CSS.supports('(--v:red)')) return
|
|
||||||
|
|
||||||
const styleBlocks = dom.findAll('style:not(.inserted),link')
|
const styleBlocks = dom.findAll('style:not(.inserted),link')
|
||||||
|
|
||||||
;[].forEach.call(styleBlocks, block => {
|
;[].forEach.call(styleBlocks, block => {
|
||||||
if (block.nodeName === 'STYLE') {
|
if (block.nodeName === 'STYLE') {
|
||||||
replaceVar(block, color)
|
replaceVar(block, color)
|
||||||
|
|
|
||||||
1039
src/plugins/emoji.js
1039
src/plugins/emoji.js
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,8 @@
|
||||||
import parser from './yaml'
|
import parser from './yaml'
|
||||||
|
|
||||||
var optionalByteOrderMark = '\\ufeff?'
|
var optionalByteOrderMark = '\\ufeff?'
|
||||||
var pattern = '^(' +
|
var pattern =
|
||||||
|
'^(' +
|
||||||
optionalByteOrderMark +
|
optionalByteOrderMark +
|
||||||
'(= yaml =|---)' +
|
'(= yaml =|---)' +
|
||||||
'$([\\s\\S]*?)' +
|
'$([\\s\\S]*?)' +
|
||||||
|
|
|
||||||
|
|
@ -29,27 +29,25 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
var errors = [],
|
var errors = [],
|
||||||
reference_blocks = [],
|
reference_blocks = [],
|
||||||
processing_time = 0,
|
processing_time = 0,
|
||||||
regex =
|
regex = {
|
||||||
{
|
regLevel: new RegExp('^([\\s\\-]+)'),
|
||||||
"regLevel" : new RegExp("^([\\s\\-]+)"),
|
invalidLine: new RegExp('^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$'),
|
||||||
"invalidLine" : new RegExp("^\\-\\-\\-|^\\.\\.\\.|^\\s*#.*|^\\s*$"),
|
dashesString: new RegExp('^\\s*\\"([^\\"]*)\\"\\s*$'),
|
||||||
"dashesString" : new RegExp("^\\s*\\\"([^\\\"]*)\\\"\\s*$"),
|
quotesString: new RegExp("^\\s*\\'([^\\']*)\\'\\s*$"),
|
||||||
"quotesString" : new RegExp("^\\s*\\\'([^\\\']*)\\\'\\s*$"),
|
float: new RegExp('^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$'),
|
||||||
"float" : new RegExp("^[+-]?[0-9]+\\.[0-9]+(e[+-]?[0-9]+(\\.[0-9]+)?)?$"),
|
integer: new RegExp('^[+-]?[0-9]+$'),
|
||||||
"integer" : new RegExp("^[+-]?[0-9]+$"),
|
array: new RegExp('\\[\\s*(.*)\\s*\\]'),
|
||||||
"array" : new RegExp("\\[\\s*(.*)\\s*\\]"),
|
map: new RegExp('\\{\\s*(.*)\\s*\\}'),
|
||||||
"map" : new RegExp("\\{\\s*(.*)\\s*\\}"),
|
key_value: new RegExp('([a-z0-9_-][ a-z0-9_-]*):( .+)', 'i'),
|
||||||
"key_value" : new RegExp("([a-z0-9_-][ a-z0-9_-]*):( .+)", "i"),
|
single_key_value: new RegExp('^([a-z0-9_-][ a-z0-9_-]*):( .+?)$', 'i'),
|
||||||
"single_key_value" : new RegExp("^([a-z0-9_-][ a-z0-9_-]*):( .+?)$", "i"),
|
key: new RegExp('([a-z0-9_-][ a-z0-9_-]+):( .+)?', 'i'),
|
||||||
"key" : new RegExp("([a-z0-9_-][ a-z0-9_-]+):( .+)?", "i"),
|
item: new RegExp('^-\\s+'),
|
||||||
"item" : new RegExp("^-\\s+"),
|
trim: new RegExp('^\\s+|\\s+$'),
|
||||||
"trim" : new RegExp("^\\s+|\\s+$"),
|
comment: new RegExp('([^\\\'\\"#]+([\\\'\\"][^\\\'\\"]*[\\\'\\"])*)*(#.*)?')
|
||||||
"comment" : new RegExp("([^\\\'\\\"#]+([\\\'\\\"][^\\\'\\\"]*[\\\'\\\"])*)*(#.*)?")
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class A block of lines of a given level.
|
* @class A block of lines of a given level.
|
||||||
|
|
@ -70,373 +68,372 @@ function Block(lvl) {
|
||||||
children: [],
|
children: [],
|
||||||
/* Add a block to the children collection */
|
/* Add a block to the children collection */
|
||||||
addChild: function(obj) {
|
addChild: function(obj) {
|
||||||
this.children.push(obj);
|
this.children.push(obj)
|
||||||
obj.parent = this;
|
obj.parent = this
|
||||||
++this.length;
|
++this.length
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// function to create an XMLHttpClient in a cross-browser manner
|
// function to create an XMLHttpClient in a cross-browser manner
|
||||||
function createXMLHTTPRequest() {
|
function createXMLHTTPRequest() {
|
||||||
var xmlhttp;
|
var xmlhttp
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Mozilla / Safari / IE7
|
// Mozilla / Safari / IE7
|
||||||
xmlhttp = new XMLHttpRequest();
|
xmlhttp = new XMLHttpRequest()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// IE
|
// IE
|
||||||
var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0',
|
var XMLHTTP_IDS = new Array(
|
||||||
|
'MSXML2.XMLHTTP.5.0',
|
||||||
'MSXML2.XMLHTTP.4.0',
|
'MSXML2.XMLHTTP.4.0',
|
||||||
'MSXML2.XMLHTTP.3.0',
|
'MSXML2.XMLHTTP.3.0',
|
||||||
'MSXML2.XMLHTTP',
|
'MSXML2.XMLHTTP',
|
||||||
'Microsoft.XMLHTTP' );
|
'Microsoft.XMLHTTP'
|
||||||
var success = false;
|
)
|
||||||
|
var success = false
|
||||||
for (var i = 0; i < XMLHTTP_IDS.length && !success; i++) {
|
for (var i = 0; i < XMLHTTP_IDS.length && !success; i++) {
|
||||||
try {
|
try {
|
||||||
xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
|
xmlhttp = new ActiveXObject(XMLHTTP_IDS[i])
|
||||||
success = true;
|
success = true
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw new Error('Unable to create XMLHttpRequest.');
|
throw new Error('Unable to create XMLHttpRequest.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return xmlhttp;
|
return xmlhttp
|
||||||
}
|
}
|
||||||
|
|
||||||
function parser(str) {
|
function parser(str) {
|
||||||
var regLevel = regex["regLevel"];
|
var regLevel = regex['regLevel']
|
||||||
var invalidLine = regex["invalidLine"];
|
var invalidLine = regex['invalidLine']
|
||||||
var lines = str.split("\n");
|
var lines = str.split('\n')
|
||||||
var m;
|
var m
|
||||||
var level = 0, curLevel = 0;
|
var level = 0,
|
||||||
|
curLevel = 0
|
||||||
|
|
||||||
var blocks = [];
|
var blocks = []
|
||||||
|
|
||||||
var result = new Block(-1);
|
var result = new Block(-1)
|
||||||
var currentBlock = new Block(0);
|
var currentBlock = new Block(0)
|
||||||
result.addChild(currentBlock);
|
result.addChild(currentBlock)
|
||||||
var levels = [];
|
var levels = []
|
||||||
var line = "";
|
var line = ''
|
||||||
|
|
||||||
blocks.push(currentBlock);
|
blocks.push(currentBlock)
|
||||||
levels.push(level);
|
levels.push(level)
|
||||||
|
|
||||||
for (var i = 0, len = lines.length; i < len; ++i) {
|
for (var i = 0, len = lines.length; i < len; ++i) {
|
||||||
line = lines[i];
|
line = lines[i]
|
||||||
|
|
||||||
if (line.match(invalidLine)) {
|
if (line.match(invalidLine)) {
|
||||||
continue;
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m = regLevel.exec(line)) {
|
if ((m = regLevel.exec(line))) {
|
||||||
level = m[1].length;
|
level = m[1].length
|
||||||
} else
|
} else level = 0
|
||||||
level = 0;
|
|
||||||
|
|
||||||
if (level > curLevel) {
|
if (level > curLevel) {
|
||||||
var oldBlock = currentBlock;
|
var oldBlock = currentBlock
|
||||||
currentBlock = new Block(level);
|
currentBlock = new Block(level)
|
||||||
oldBlock.addChild(currentBlock);
|
oldBlock.addChild(currentBlock)
|
||||||
blocks.push(currentBlock);
|
blocks.push(currentBlock)
|
||||||
levels.push(level);
|
levels.push(level)
|
||||||
} else if (level < curLevel) {
|
} else if (level < curLevel) {
|
||||||
var added = false;
|
var added = false
|
||||||
|
|
||||||
var k = levels.length - 1;
|
var k = levels.length - 1
|
||||||
for (; k >= 0; --k) {
|
for (; k >= 0; --k) {
|
||||||
if (levels[k] == level) {
|
if (levels[k] == level) {
|
||||||
currentBlock = new Block(level);
|
currentBlock = new Block(level)
|
||||||
blocks.push(currentBlock);
|
blocks.push(currentBlock)
|
||||||
levels.push(level);
|
levels.push(level)
|
||||||
if(blocks[k].parent!= null)
|
if (blocks[k].parent != null) blocks[k].parent.addChild(currentBlock)
|
||||||
blocks[k].parent.addChild(currentBlock);
|
added = true
|
||||||
added = true;
|
break
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!added) {
|
if (!added) {
|
||||||
errors.push("Error: Invalid indentation at line " + i + ": " + line);
|
errors.push('Error: Invalid indentation at line ' + i + ': ' + line)
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentBlock.lines.push(line.replace(regex["trim"], ""));
|
currentBlock.lines.push(line.replace(regex['trim'], ''))
|
||||||
curLevel = level;
|
curLevel = level
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
function processValue(val) {
|
function processValue(val) {
|
||||||
val = val.replace(regex["trim"], "");
|
val = val.replace(regex['trim'], '')
|
||||||
var m = null;
|
var m = null
|
||||||
|
|
||||||
if (val == 'true') {
|
if (val == 'true') {
|
||||||
return true;
|
return true
|
||||||
} else if (val == 'false') {
|
} else if (val == 'false') {
|
||||||
return false;
|
return false
|
||||||
} else if (val == '.NaN') {
|
} else if (val == '.NaN') {
|
||||||
return Number.NaN;
|
return Number.NaN
|
||||||
} else if (val == 'null') {
|
} else if (val == 'null') {
|
||||||
return null;
|
return null
|
||||||
} else if (val == '.inf') {
|
} else if (val == '.inf') {
|
||||||
return Number.POSITIVE_INFINITY;
|
return Number.POSITIVE_INFINITY
|
||||||
} else if (val == '-.inf') {
|
} else if (val == '-.inf') {
|
||||||
return Number.NEGATIVE_INFINITY;
|
return Number.NEGATIVE_INFINITY
|
||||||
} else if(m = val.match(regex["dashesString"])) {
|
} else if ((m = val.match(regex['dashesString']))) {
|
||||||
return m[1];
|
return m[1]
|
||||||
} else if(m = val.match(regex["quotesString"])) {
|
} else if ((m = val.match(regex['quotesString']))) {
|
||||||
return m[1];
|
return m[1]
|
||||||
} else if(m = val.match(regex["float"])) {
|
} else if ((m = val.match(regex['float']))) {
|
||||||
return parseFloat(m[0]);
|
return parseFloat(m[0])
|
||||||
} else if(m = val.match(regex["integer"])) {
|
} else if ((m = val.match(regex['integer']))) {
|
||||||
return parseInt(m[0]);
|
return parseInt(m[0])
|
||||||
} else if( !isNaN(m = Date.parse(val))) {
|
} else if (!isNaN((m = Date.parse(val)))) {
|
||||||
return new Date(m);
|
return new Date(m)
|
||||||
} else if(m = val.match(regex["single_key_value"])) {
|
} else if ((m = val.match(regex['single_key_value']))) {
|
||||||
var res = {};
|
var res = {}
|
||||||
res[m[1]] = processValue(m[2]);
|
res[m[1]] = processValue(m[2])
|
||||||
return res;
|
return res
|
||||||
} else if(m = val.match(regex["array"])){
|
} else if ((m = val.match(regex['array']))) {
|
||||||
var count = 0, c = ' ';
|
var count = 0,
|
||||||
var res = [];
|
c = ' '
|
||||||
var content = "";
|
var res = []
|
||||||
var str = false;
|
var content = ''
|
||||||
|
var str = false
|
||||||
for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||||
c = m[1][j];
|
c = m[1][j]
|
||||||
if(c == '\'' || c == '"') {
|
if (c == "'" || c == '"') {
|
||||||
if (str === false) {
|
if (str === false) {
|
||||||
str = c;
|
str = c
|
||||||
content += c;
|
content += c
|
||||||
continue;
|
continue
|
||||||
} else if((c == '\'' && str == '\'') || (c == '"' && str == '"')) {
|
} else if ((c == "'" && str == "'") || (c == '"' && str == '"')) {
|
||||||
str = false;
|
str = false
|
||||||
content += c;
|
content += c
|
||||||
continue;
|
continue
|
||||||
}
|
}
|
||||||
} else if (str === false && (c == '[' || c == '{')) {
|
} else if (str === false && (c == '[' || c == '{')) {
|
||||||
++count;
|
++count
|
||||||
} else if (str === false && (c == ']' || c == '}')) {
|
} else if (str === false && (c == ']' || c == '}')) {
|
||||||
--count;
|
--count
|
||||||
} else if (str === false && count == 0 && c == ',') {
|
} else if (str === false && count == 0 && c == ',') {
|
||||||
res.push(processValue(content));
|
res.push(processValue(content))
|
||||||
content = "";
|
content = ''
|
||||||
continue;
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
content += c;
|
content += c
|
||||||
}
|
}
|
||||||
|
|
||||||
if(content.length > 0)
|
if (content.length > 0) res.push(processValue(content))
|
||||||
res.push(processValue(content));
|
return res
|
||||||
return res;
|
} else if ((m = val.match(regex['map']))) {
|
||||||
} else if(m = val.match(regex["map"])){
|
var count = 0,
|
||||||
var count = 0, c = ' ';
|
c = ' '
|
||||||
var res = [];
|
var res = []
|
||||||
var content = "";
|
var content = ''
|
||||||
var str = false;
|
var str = false
|
||||||
for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
for (var j = 0, lenJ = m[1].length; j < lenJ; ++j) {
|
||||||
c = m[1][j];
|
c = m[1][j]
|
||||||
if(c == '\'' || c == '"') {
|
if (c == "'" || c == '"') {
|
||||||
if (str === false) {
|
if (str === false) {
|
||||||
str = c;
|
str = c
|
||||||
content += c;
|
content += c
|
||||||
continue;
|
continue
|
||||||
} else if((c == '\'' && str == '\'') || (c == '"' && str == '"')) {
|
} else if ((c == "'" && str == "'") || (c == '"' && str == '"')) {
|
||||||
str = false;
|
str = false
|
||||||
content += c;
|
content += c
|
||||||
continue;
|
continue
|
||||||
}
|
}
|
||||||
} else if (str === false && (c == '[' || c == '{')) {
|
} else if (str === false && (c == '[' || c == '{')) {
|
||||||
++count;
|
++count
|
||||||
} else if (str === false && (c == ']' || c == '}')) {
|
} else if (str === false && (c == ']' || c == '}')) {
|
||||||
--count;
|
--count
|
||||||
} else if (str === false && count == 0 && c == ',') {
|
} else if (str === false && count == 0 && c == ',') {
|
||||||
res.push(content);
|
res.push(content)
|
||||||
content = "";
|
content = ''
|
||||||
continue;
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
content += c;
|
content += c
|
||||||
}
|
}
|
||||||
|
|
||||||
if(content.length > 0)
|
if (content.length > 0) res.push(content)
|
||||||
res.push(content);
|
|
||||||
|
|
||||||
var newRes = {};
|
var newRes = {}
|
||||||
for (var j = 0, lenJ = res.length; j < lenJ; ++j) {
|
for (var j = 0, lenJ = res.length; j < lenJ; ++j) {
|
||||||
if(m = res[j].match(regex["key_value"])) {
|
if ((m = res[j].match(regex['key_value']))) {
|
||||||
newRes[m[1]] = processValue(m[2]);
|
newRes[m[1]] = processValue(m[2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return newRes;
|
return newRes
|
||||||
} else
|
} else return val
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function processFoldedBlock(block) {
|
function processFoldedBlock(block) {
|
||||||
var lines = block.lines;
|
var lines = block.lines
|
||||||
var children = block.children;
|
var children = block.children
|
||||||
var str = lines.join(" ");
|
var str = lines.join(' ')
|
||||||
var chunks = [str];
|
var chunks = [str]
|
||||||
for (var i = 0, len = children.length; i < len; ++i) {
|
for (var i = 0, len = children.length; i < len; ++i) {
|
||||||
chunks.push(processFoldedBlock(children[i]));
|
chunks.push(processFoldedBlock(children[i]))
|
||||||
}
|
}
|
||||||
return chunks.join("\n");
|
return chunks.join('\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
function processLiteralBlock(block) {
|
function processLiteralBlock(block) {
|
||||||
var lines = block.lines;
|
var lines = block.lines
|
||||||
var children = block.children;
|
var children = block.children
|
||||||
var str = lines.join("\n");
|
var str = lines.join('\n')
|
||||||
for (var i = 0, len = children.length; i < len; ++i) {
|
for (var i = 0, len = children.length; i < len; ++i) {
|
||||||
str += processLiteralBlock(children[i]);
|
str += processLiteralBlock(children[i])
|
||||||
}
|
}
|
||||||
return str;
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
function processBlock(blocks) {
|
function processBlock(blocks) {
|
||||||
var m = null;
|
var m = null
|
||||||
var res = {};
|
var res = {}
|
||||||
var lines = null;
|
var lines = null
|
||||||
var children = null;
|
var children = null
|
||||||
var currentObj = null;
|
var currentObj = null
|
||||||
|
|
||||||
var level = -1;
|
var level = -1
|
||||||
|
|
||||||
var processedBlocks = [];
|
var processedBlocks = []
|
||||||
|
|
||||||
var isMap = true;
|
var isMap = true
|
||||||
|
|
||||||
for (var j = 0, lenJ = blocks.length; j < lenJ; ++j) {
|
for (var j = 0, lenJ = blocks.length; j < lenJ; ++j) {
|
||||||
|
if (level != -1 && level != blocks[j].level) continue
|
||||||
|
|
||||||
if(level != -1 && level != blocks[j].level)
|
processedBlocks.push(j)
|
||||||
continue;
|
|
||||||
|
|
||||||
processedBlocks.push(j);
|
level = blocks[j].level
|
||||||
|
lines = blocks[j].lines
|
||||||
level = blocks[j].level;
|
children = blocks[j].children
|
||||||
lines = blocks[j].lines;
|
currentObj = null
|
||||||
children = blocks[j].children;
|
|
||||||
currentObj = null;
|
|
||||||
|
|
||||||
for (var i = 0, len = lines.length; i < len; ++i) {
|
for (var i = 0, len = lines.length; i < len; ++i) {
|
||||||
var line = lines[i];
|
var line = lines[i]
|
||||||
|
|
||||||
if(m = line.match(regex["key"])) {
|
if ((m = line.match(regex['key']))) {
|
||||||
var key = m[1];
|
var key = m[1]
|
||||||
|
|
||||||
if (key[0] == '-') {
|
if (key[0] == '-') {
|
||||||
key = key.replace(regex["item"], "");
|
key = key.replace(regex['item'], '')
|
||||||
if (isMap) {
|
if (isMap) {
|
||||||
isMap = false;
|
isMap = false
|
||||||
if (typeof(res.length) === "undefined") {
|
if (typeof res.length === 'undefined') {
|
||||||
res = [];
|
res = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(currentObj != null) res.push(currentObj);
|
if (currentObj != null) res.push(currentObj)
|
||||||
currentObj = {};
|
currentObj = {}
|
||||||
isMap = true;
|
isMap = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof m[2] != "undefined") {
|
if (typeof m[2] != 'undefined') {
|
||||||
var value = m[2].replace(regex["trim"], "");
|
var value = m[2].replace(regex['trim'], '')
|
||||||
if (value[0] == '&') {
|
if (value[0] == '&') {
|
||||||
var nb = processBlock(children);
|
var nb = processBlock(children)
|
||||||
if(currentObj != null) currentObj[key] = nb;
|
if (currentObj != null) currentObj[key] = nb
|
||||||
else res[key] = nb;
|
else res[key] = nb
|
||||||
reference_blocks[value.substr(1)] = nb;
|
reference_blocks[value.substr(1)] = nb
|
||||||
} else if (value[0] == '|') {
|
} else if (value[0] == '|') {
|
||||||
if(currentObj != null) currentObj[key] = processLiteralBlock(children.shift());
|
if (currentObj != null)
|
||||||
else res[key] = processLiteralBlock(children.shift());
|
currentObj[key] = processLiteralBlock(children.shift())
|
||||||
|
else res[key] = processLiteralBlock(children.shift())
|
||||||
} else if (value[0] == '*') {
|
} else if (value[0] == '*') {
|
||||||
var v = value.substr(1);
|
var v = value.substr(1)
|
||||||
var no = {};
|
var no = {}
|
||||||
|
|
||||||
if(typeof reference_blocks[v] == "undefined") {
|
if (typeof reference_blocks[v] == 'undefined') {
|
||||||
errors.push("Reference '" + v + "' not found!");
|
errors.push("Reference '" + v + "' not found!")
|
||||||
} else {
|
} else {
|
||||||
for (var k in reference_blocks[v]) {
|
for (var k in reference_blocks[v]) {
|
||||||
no[k] = reference_blocks[v][k];
|
no[k] = reference_blocks[v][k]
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentObj != null) currentObj[key] = no;
|
if (currentObj != null) currentObj[key] = no
|
||||||
else res[key] = no;
|
else res[key] = no
|
||||||
}
|
}
|
||||||
} else if (value[0] == '>') {
|
} else if (value[0] == '>') {
|
||||||
if(currentObj != null) currentObj[key] = processFoldedBlock(children.shift());
|
if (currentObj != null)
|
||||||
else res[key] = processFoldedBlock(children.shift());
|
currentObj[key] = processFoldedBlock(children.shift())
|
||||||
|
else res[key] = processFoldedBlock(children.shift())
|
||||||
} else {
|
} else {
|
||||||
if(currentObj != null) currentObj[key] = processValue(value);
|
if (currentObj != null) currentObj[key] = processValue(value)
|
||||||
else res[key] = processValue(value);
|
else res[key] = processValue(value)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(currentObj != null) currentObj[key] = processBlock(children);
|
if (currentObj != null) currentObj[key] = processBlock(children)
|
||||||
else res[key] = processBlock(children);
|
else res[key] = processBlock(children)
|
||||||
}
|
}
|
||||||
} else if (line.match(/^-\s*$/)) {
|
} else if (line.match(/^-\s*$/)) {
|
||||||
if (isMap) {
|
if (isMap) {
|
||||||
isMap = false;
|
isMap = false
|
||||||
if (typeof(res.length) === "undefined") {
|
if (typeof res.length === 'undefined') {
|
||||||
res = [];
|
res = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(currentObj != null) res.push(currentObj);
|
if (currentObj != null) res.push(currentObj)
|
||||||
currentObj = {};
|
currentObj = {}
|
||||||
isMap = true;
|
isMap = true
|
||||||
continue;
|
continue
|
||||||
} else if(m = line.match(/^-\s*(.*)/)) {
|
} else if ((m = line.match(/^-\s*(.*)/))) {
|
||||||
if(currentObj != null)
|
if (currentObj != null) currentObj.push(processValue(m[1]))
|
||||||
currentObj.push(processValue(m[1]));
|
|
||||||
else {
|
else {
|
||||||
if (isMap) {
|
if (isMap) {
|
||||||
isMap = false;
|
isMap = false
|
||||||
if (typeof(res.length) === "undefined") {
|
if (typeof res.length === 'undefined') {
|
||||||
res = [];
|
res = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.push(processValue(m[1]));
|
res.push(processValue(m[1]))
|
||||||
}
|
}
|
||||||
continue;
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentObj != null) {
|
if (currentObj != null) {
|
||||||
if (isMap) {
|
if (isMap) {
|
||||||
isMap = false;
|
isMap = false
|
||||||
if (typeof(res.length) === "undefined") {
|
if (typeof res.length === 'undefined') {
|
||||||
res = [];
|
res = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.push(currentObj);
|
res.push(currentObj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = processedBlocks.length - 1; j >= 0; --j) {
|
for (var j = processedBlocks.length - 1; j >= 0; --j) {
|
||||||
blocks.splice.call(blocks, processedBlocks[j], 1);
|
blocks.splice.call(blocks, processedBlocks[j], 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
function semanticAnalysis(blocks) {
|
function semanticAnalysis(blocks) {
|
||||||
var res = processBlock(blocks.children);
|
var res = processBlock(blocks.children)
|
||||||
return res;
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
function preProcess(src) {
|
function preProcess(src) {
|
||||||
var m;
|
var m
|
||||||
var lines = src.split("\n");
|
var lines = src.split('\n')
|
||||||
|
|
||||||
var r = regex["comment"];
|
var r = regex['comment']
|
||||||
|
|
||||||
for (var i in lines) {
|
for (var i in lines) {
|
||||||
if(m = lines[i].match(r)) {
|
if ((m = lines[i].match(r))) {
|
||||||
/* var cmt = "";
|
/* var cmt = "";
|
||||||
if(typeof m[3] != "undefined")
|
if(typeof m[3] != "undefined")
|
||||||
lines[i] = m[1];
|
lines[i] = m[1];
|
||||||
|
|
@ -445,25 +442,25 @@ function preProcess(src) {
|
||||||
else
|
else
|
||||||
lines[i] = "";
|
lines[i] = "";
|
||||||
*/
|
*/
|
||||||
if(typeof m[3] !== "undefined") {
|
if (typeof m[3] !== 'undefined') {
|
||||||
lines[i] = m[0].substr(0, m[0].length - m[3].length);
|
lines[i] = m[0].substr(0, m[0].length - m[3].length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines.join("\n");
|
return lines.join('\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
function load(str) {
|
function load(str) {
|
||||||
errors = [];
|
errors = []
|
||||||
reference_blocks = [];
|
reference_blocks = []
|
||||||
processing_time = (new Date()).getTime();
|
processing_time = new Date().getTime()
|
||||||
var pre = preProcess(str)
|
var pre = preProcess(str)
|
||||||
var doc = parser(pre);
|
var doc = parser(pre)
|
||||||
var res = semanticAnalysis(doc);
|
var res = semanticAnalysis(doc)
|
||||||
processing_time = (new Date()).getTime() - processing_time;
|
processing_time = new Date().getTime() - processing_time
|
||||||
|
|
||||||
return res;
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
export default load
|
export default load
|
||||||
|
|
@ -8,8 +8,10 @@ function appendScript () {
|
||||||
|
|
||||||
function init (id) {
|
function init (id) {
|
||||||
appendScript()
|
appendScript()
|
||||||
window.ga = window.ga || function () {
|
window.ga =
|
||||||
(window.ga.q = window.ga.q || []).push(arguments)
|
window.ga ||
|
||||||
|
function () {
|
||||||
|
;(window.ga.q = window.ga.q || []).push(arguments)
|
||||||
}
|
}
|
||||||
window.ga.l = Number(new Date())
|
window.ga.l = Number(new Date())
|
||||||
window.ga('create', id, 'auto')
|
window.ga('create', id, 'auto')
|
||||||
|
|
|
||||||
|
|
@ -109,8 +109,11 @@ function bindEvents () {
|
||||||
|
|
||||||
let timeId
|
let timeId
|
||||||
// Prevent to Fold sidebar
|
// Prevent to Fold sidebar
|
||||||
Docsify.dom.on($search, 'click',
|
Docsify.dom.on(
|
||||||
e => e.target.tagName !== 'A' && e.stopPropagation())
|
$search,
|
||||||
|
'click',
|
||||||
|
e => e.target.tagName !== 'A' && e.stopPropagation()
|
||||||
|
)
|
||||||
Docsify.dom.on($input, 'input', e => {
|
Docsify.dom.on($input, 'input', e => {
|
||||||
clearTimeout(timeId)
|
clearTimeout(timeId)
|
||||||
timeId = setTimeout(_ => doSearch(e.target.value.trim()), 100)
|
timeId = setTimeout(_ => doSearch(e.target.value.trim()), 100)
|
||||||
|
|
@ -151,4 +154,3 @@ export function update (opts, vm) {
|
||||||
updatePlaceholder(opts.placeholder, vm.route.path)
|
updatePlaceholder(opts.placeholder, vm.route.path)
|
||||||
updateNoData(opts.noData, vm.route.path)
|
updateNoData(opts.noData, vm.route.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ section.cover {
|
||||||
|
|
||||||
&.has-mask .mask {
|
&.has-mask .mask {
|
||||||
background-color: $color-bg;
|
background-color: $color-bg;
|
||||||
opacity: .8;
|
opacity: 0.8;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
size: 100%;
|
size: 100%;
|
||||||
}
|
}
|
||||||
|
|
@ -42,7 +42,7 @@ section.cover {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
font-size: 2.5rem;
|
font-size: 2.5rem;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
margin: .625rem 0 2.5rem;
|
margin: 0.625rem 0 2.5rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ section.cover {
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
opacity: .8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ section.cover {
|
||||||
|
|
||||||
blockquote > p > a {
|
blockquote > p > a {
|
||||||
border-bottom: 2px solid var(--theme-color, $color-primary);
|
border-bottom: 2px solid var(--theme-color, $color-primary);
|
||||||
transition: color .3s;
|
transition: color 0.3s;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--theme-color, $color-primary);
|
color: var(--theme-color, $color-primary);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
body:not(.ready) {
|
body:not(.ready) {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
[data-cloak], .app-nav, > nav {
|
[data-cloak],
|
||||||
|
.app-nav,
|
||||||
|
> nav {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +24,7 @@ div#app {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
&:empty::before {
|
&:empty::before {
|
||||||
content: "Loading...";
|
content: 'Loading...';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,7 +54,8 @@ div#app {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
html, body {
|
html,
|
||||||
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,7 +107,8 @@ kbd {
|
||||||
padding: 5px 0;
|
padding: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul, li {
|
ul,
|
||||||
|
li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
@ -114,7 +118,7 @@ kbd {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: color .3s;
|
transition: color 0.3s;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--theme-color, $color-primary);
|
color: var(--theme-color, $color-primary);
|
||||||
|
|
@ -207,7 +211,7 @@ main {
|
||||||
.anchor {
|
.anchor {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: all .3s;
|
transition: all 0.3s;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
color: $color-text;
|
color: $color-text;
|
||||||
|
|
@ -220,7 +224,7 @@ main {
|
||||||
|
|
||||||
/* sidebar */
|
/* sidebar */
|
||||||
.sidebar {
|
.sidebar {
|
||||||
border-right: 1px solid rgba(0, 0, 0, .07);
|
border-right: 1px solid rgba(0, 0, 0, 0.07);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 40px 0;
|
padding: 40px 0;
|
||||||
position: absolute 0 * 0 0;
|
position: absolute 0 * 0 0;
|
||||||
|
|
@ -259,7 +263,8 @@ main {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul, ul li {
|
ul,
|
||||||
|
ul li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,20 +298,20 @@ main {
|
||||||
/* sidebar toggle */
|
/* sidebar toggle */
|
||||||
.sidebar-toggle {
|
.sidebar-toggle {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
background-color: rgba($color-bg, .8);
|
background-color: rgba($color-bg, 0.8);
|
||||||
border: 0;
|
border: 0;
|
||||||
outline: none;
|
outline: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
position: absolute * * 0 0;
|
position: absolute * * 0 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
transition: opacity .3s;
|
transition: opacity 0.3s;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
width: calc($sidebar-width - 16px);
|
width: calc($sidebar-width - 16px);
|
||||||
z-index: 30;
|
z-index: 30;
|
||||||
|
|
||||||
.sidebar-toggle-button:hover {
|
.sidebar-toggle-button:hover {
|
||||||
opacity: .4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
|
|
@ -318,7 +323,8 @@ main {
|
||||||
}
|
}
|
||||||
|
|
||||||
body.sticky {
|
body.sticky {
|
||||||
.sidebar, .sidebar-toggle {
|
.sidebar,
|
||||||
|
.sidebar-toggle {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -393,7 +399,7 @@ body.sticky {
|
||||||
background-color: #f66;
|
background-color: #f66;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
color: $color-bg;
|
color: $color-bg;
|
||||||
content: "!";
|
content: '!';
|
||||||
font-family: 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
|
font-family: 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
@ -435,7 +441,9 @@ body.close {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
.github-corner, .sidebar-toggle, .sidebar {
|
.github-corner,
|
||||||
|
.sidebar-toggle,
|
||||||
|
.sidebar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -445,7 +453,9 @@ body.close {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
@media screen and (max-width: 768px) {
|
||||||
.github-corner, .sidebar-toggle, .sidebar {
|
.github-corner,
|
||||||
|
.sidebar-toggle,
|
||||||
|
.sidebar {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -475,7 +485,8 @@ body.close {
|
||||||
transition: transform 250ms ease;
|
transition: transform 250ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-nav, .github-corner {
|
.app-nav,
|
||||||
|
.github-corner {
|
||||||
transition: transform 250ms ease-out;
|
transition: transform 250ms ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -490,7 +501,7 @@ body.close {
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-toggle {
|
.sidebar-toggle {
|
||||||
background-color: rgba($color-bg, .8);
|
background-color: rgba($color-bg, 0.8);
|
||||||
transition: 1s background-color;
|
transition: 1s background-color;
|
||||||
width: calc($sidebar-width - 16px);
|
width: calc($sidebar-width - 16px);
|
||||||
}
|
}
|
||||||
|
|
@ -499,7 +510,8 @@ body.close {
|
||||||
transform: translateX($sidebar-width);
|
transform: translateX($sidebar-width);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-nav, .github-corner {
|
.app-nav,
|
||||||
|
.github-corner {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -515,7 +527,16 @@ body.close {
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes octocat-wave {
|
@keyframes octocat-wave {
|
||||||
0%,100% { transform: rotate(0); }
|
0%,
|
||||||
20%,60% { transform: rotate(-25deg); }
|
100% {
|
||||||
40%,80% { transform: rotate(10deg); }
|
transform: rotate(0);
|
||||||
|
}
|
||||||
|
20%,
|
||||||
|
60% {
|
||||||
|
transform: rotate(-25deg);
|
||||||
|
}
|
||||||
|
40%,
|
||||||
|
80% {
|
||||||
|
transform: rotate(10deg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
@import url('https://fonts.googleapis.com/css?family=Inconsolata|Inconsolata-Bold');
|
@import url('https://fonts.googleapis.com/css?family=Inconsolata|Inconsolata-Bold');
|
||||||
|
|
||||||
$color-primary: #0074D9;
|
$color-primary: #0074d9;
|
||||||
$color-bg: #fff;
|
$color-bg: #fff;
|
||||||
$color-text: #34495e;
|
$color-text: #34495e;
|
||||||
$sidebar-width: 16rem;
|
$sidebar-width: 16rem;
|
||||||
|
|
||||||
@import "basic/layout";
|
@import 'basic/layout';
|
||||||
@import "basic/coverpage";
|
@import 'basic/coverpage';
|
||||||
|
|
||||||
/* sidebar */
|
/* sidebar */
|
||||||
.sidebar {
|
.sidebar {
|
||||||
|
|
@ -160,7 +160,7 @@ $sidebar-width: 16rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.namespace {
|
.namespace {
|
||||||
opacity: .7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.token.property,
|
.token.property,
|
||||||
|
|
@ -229,7 +229,8 @@ $sidebar-width: 16rem;
|
||||||
white-space: inherit;
|
white-space: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-section code::after, .markdown-section code::before {
|
.markdown-section code::after,
|
||||||
|
.markdown-section code::before {
|
||||||
letter-spacing: 0.05rem;
|
letter-spacing: 0.05rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ $color-bg: #3f3f3f;
|
||||||
$color-text: #c8c8c8;
|
$color-text: #c8c8c8;
|
||||||
$sidebar-width: 300px;
|
$sidebar-width: 300px;
|
||||||
|
|
||||||
@import "basic/layout";
|
@import 'basic/layout';
|
||||||
@import "basic/coverpage";
|
@import 'basic/coverpage';
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: $color-bg;
|
background-color: $color-bg;
|
||||||
|
|
@ -71,7 +71,7 @@ body {
|
||||||
|
|
||||||
.markdown-section h3 {
|
.markdown-section h3 {
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
margin: 40px 0 .6rem;
|
margin: 40px 0 0.6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-section h4 {
|
.markdown-section h4 {
|
||||||
|
|
@ -159,7 +159,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.token.namespace {
|
.token.namespace {
|
||||||
opacity: .7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.token.boolean,
|
.token.boolean,
|
||||||
|
|
@ -263,7 +263,8 @@ body {
|
||||||
white-space: inherit;
|
white-space: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-section code::after, .markdown-section code::before {
|
.markdown-section code::after,
|
||||||
|
.markdown-section code::before {
|
||||||
letter-spacing: 0.05rem;
|
letter-spacing: 0.05rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -292,7 +293,7 @@ pre::after {
|
||||||
color: #657b83;
|
color: #657b83;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="search"] {
|
input[type='search'] {
|
||||||
background: #4f4f4f;
|
background: #4f4f4f;
|
||||||
border-color: #4f4f4f;
|
border-color: #4f4f4f;
|
||||||
color: #c8c8c8;
|
color: #c8c8c8;
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@ $color-primary: #000;
|
||||||
$color-bg: #fff;
|
$color-bg: #fff;
|
||||||
$color-text: #000;
|
$color-text: #000;
|
||||||
$sidebar-width: 300px;
|
$sidebar-width: 300px;
|
||||||
@import "basic/layout";
|
@import 'basic/layout';
|
||||||
@import "basic/coverpage";
|
@import 'basic/coverpage';
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ $color-bg: #fff;
|
||||||
$color-text: #34495e;
|
$color-text: #34495e;
|
||||||
$sidebar-width: 300px;
|
$sidebar-width: 300px;
|
||||||
|
|
||||||
@import "basic/layout";
|
@import 'basic/layout';
|
||||||
@import "basic/coverpage";
|
@import 'basic/coverpage';
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: $color-bg;
|
background-color: $color-bg;
|
||||||
|
|
@ -82,7 +82,7 @@ body {
|
||||||
|
|
||||||
.markdown-section h3 {
|
.markdown-section h3 {
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
margin: 40px 0 .6rem;
|
margin: 40px 0 0.6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-section h4 {
|
.markdown-section h4 {
|
||||||
|
|
@ -170,7 +170,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.token.namespace {
|
.token.namespace {
|
||||||
opacity: .7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.token.boolean,
|
.token.boolean,
|
||||||
|
|
@ -274,7 +274,8 @@ body {
|
||||||
white-space: inherit;
|
white-space: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-section code::after, .markdown-section code::before {
|
.markdown-section code::after,
|
||||||
|
.markdown-section code::before {
|
||||||
letter-spacing: 0.05rem;
|
letter-spacing: 0.05rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue