mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-09 13:26:34 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d91a66cadd | ||
|
|
58b130996e | ||
|
|
ee800a6572 | ||
|
|
6daecc8a68 | ||
|
|
325ecd08e6 | ||
|
|
9a09458eee | ||
|
|
fdd8826b3b | ||
|
|
fcd1087c16 | ||
|
|
ab19b13210 | ||
|
|
5fcf210dd1 | ||
|
|
2edf47ec73 | ||
|
|
b52607dec9 | ||
|
|
e89a2b3fea | ||
|
|
239eb3503b | ||
|
|
fce40eae25 | ||
|
|
d35059dd0b | ||
|
|
4f588e0af4 | ||
|
|
22ab7dfd14 | ||
|
|
4805cb5322 | ||
|
|
2bc880d335 |
@@ -1,3 +1,43 @@
|
||||
<a name="4.8.3"></a>
|
||||
## [4.8.3](https://github.com/docsifyjs/docsify/compare/v4.8.2...v4.8.3) (2018-11-01)
|
||||
|
||||
|
||||
|
||||
<a name="4.8.2"></a>
|
||||
## [4.8.2](https://github.com/docsifyjs/docsify/compare/v4.8.1...v4.8.2) (2018-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cover button style, fixed [#670](https://github.com/docsifyjs/docsify/issues/670), fixed [#665](https://github.com/docsifyjs/docsify/issues/665) ([#675](https://github.com/docsifyjs/docsify/issues/675)) ([fcd1087](https://github.com/docsifyjs/docsify/commit/fcd1087))
|
||||
* update match regex ([#669](https://github.com/docsifyjs/docsify/issues/669)) ([2edf47e](https://github.com/docsifyjs/docsify/commit/2edf47e))
|
||||
* use copy of cached value ([#668](https://github.com/docsifyjs/docsify/issues/668)) ([5fcf210](https://github.com/docsifyjs/docsify/commit/5fcf210))
|
||||
* **compiler:** import prism-markup-templating, fixed [#672](https://github.com/docsifyjs/docsify/issues/672) ([#676](https://github.com/docsifyjs/docsify/issues/676)) ([fdd8826](https://github.com/docsifyjs/docsify/commit/fdd8826))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add heading config id ([#671](https://github.com/docsifyjs/docsify/issues/671)) ([ab19b13](https://github.com/docsifyjs/docsify/commit/ab19b13))
|
||||
|
||||
|
||||
|
||||
<a name="4.8.1"></a>
|
||||
## [4.8.1](https://github.com/docsifyjs/docsify/compare/v4.8.0...v4.8.1) (2018-10-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ssr package dep, fixed [#605](https://github.com/docsifyjs/docsify/issues/605) ([2bc880d](https://github.com/docsifyjs/docsify/commit/2bc880d))
|
||||
* **compiler:** extra quotes for codeblock ([4f588e0](https://github.com/docsifyjs/docsify/commit/4f588e0))
|
||||
* **compiler:** prevent render of html code in paragraph, fixed [#663](https://github.com/docsifyjs/docsify/issues/663) ([d35059d](https://github.com/docsifyjs/docsify/commit/d35059d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* upgrade PrismJS, fixed [#534](https://github.com/docsifyjs/docsify/issues/534) ([4805cb5](https://github.com/docsifyjs/docsify/commit/4805cb5))
|
||||
|
||||
|
||||
|
||||
<a name="4.8.0"></a>
|
||||
# [4.8.0](https://github.com/docsifyjs/docsify/compare/v4.7.1...v4.8.0) (2018-10-31)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
## Features
|
||||
|
||||
- No statically built html files
|
||||
- Simple and lightweight (~19kB gzipped)
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- Smart full-text search plugin
|
||||
- Multiple themes
|
||||
- Useful plugin API
|
||||
@@ -46,7 +46,9 @@
|
||||
|
||||
## Quick start
|
||||
|
||||
Look at [this tutorial](https://docsify.js.org/#/quickstart) or [online demo](https://jsfiddle.net/7ztb8qsr/1/).
|
||||
Look at [this tutorial](https://docsify.js.org/#/quickstart)
|
||||
|
||||
[](https://codesandbox.io/s/307qqv236)
|
||||
|
||||
## Showcase
|
||||
|
||||
@@ -103,6 +105,6 @@ This project exists thanks to all the people who contribute. [[Contribute](CONTR
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
[MIT](LICENSE)
|
||||
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fdocsifyjs%2Fdocsify?ref=badge_large)
|
||||
|
||||
+5
-7
@@ -8,14 +8,12 @@ const isProd = process.env.NODE_ENV === 'production'
|
||||
const version = process.env.VERSION || require('../package.json').version
|
||||
const chokidar = require('chokidar')
|
||||
const path = require('path')
|
||||
const json = require('rollup-plugin-json')
|
||||
|
||||
const build = function(opts) {
|
||||
const build = function (opts) {
|
||||
rollup
|
||||
.rollup({
|
||||
input: opts.input,
|
||||
plugins: (opts.plugins || []).concat([
|
||||
json(),
|
||||
buble(),
|
||||
commonjs(),
|
||||
nodeResolve(),
|
||||
@@ -25,7 +23,7 @@ const build = function(opts) {
|
||||
})
|
||||
])
|
||||
})
|
||||
.then(function(bundle) {
|
||||
.then(function (bundle) {
|
||||
var dest = 'lib/' + (opts.output || opts.input)
|
||||
|
||||
console.log(dest)
|
||||
@@ -35,11 +33,11 @@ const build = function(opts) {
|
||||
strict: false
|
||||
})
|
||||
})
|
||||
.catch(function(err) {
|
||||
.catch(function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
const buildCore = function() {
|
||||
const buildCore = function () {
|
||||
build({
|
||||
input: 'src/core/index.js',
|
||||
output: 'docsify.js'
|
||||
@@ -53,7 +51,7 @@ const buildCore = function() {
|
||||
})
|
||||
}
|
||||
}
|
||||
const buildAllPlugin = function() {
|
||||
const buildAllPlugin = function () {
|
||||
var plugins = [
|
||||
{name: 'search', input: 'search/index.js'},
|
||||
{name: 'ga', input: 'ga.js'},
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ See the [Quick start](quickstart.md) guide for more details.
|
||||
## Features
|
||||
|
||||
- No statically built html files
|
||||
- Simple and lightweight (~19kB gzipped)
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- Smart full-text search plugin
|
||||
- Multiple themes
|
||||
- Useful plugin API
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||

|
||||
|
||||
# docsify <small>4.8.0</small>
|
||||
# docsify <small>4.8.3</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
* Simple and lightweight (~19kB gzipped)
|
||||
* No statically built html files
|
||||
* Multiple themes
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- No statically built html files
|
||||
- Multiple themes
|
||||
|
||||
[GitHub](https://github.com/docsifyjs/docsify/)
|
||||
[Getting Started](#docsify)
|
||||
|
||||
+22
-22
@@ -1,28 +1,28 @@
|
||||
* Getting started
|
||||
- Getting started
|
||||
|
||||
* [Quick start](quickstart.md)
|
||||
* [Writing more pages](more-pages.md)
|
||||
* [Custom navbar](custom-navbar.md)
|
||||
* [Cover page](cover.md)
|
||||
- [Quick start](quickstart.md)
|
||||
- [Writing more pages](more-pages.md)
|
||||
- [Custom navbar](custom-navbar.md)
|
||||
- [Cover page](cover.md)
|
||||
|
||||
* Customization
|
||||
- Customization
|
||||
|
||||
* [Configuration](configuration.md)
|
||||
* [Themes](themes.md)
|
||||
* [List of Plugins](plugins.md)
|
||||
* [Write a Plugin](write-a-plugin.md)
|
||||
* [Markdown configuration](markdown.md)
|
||||
* [Language highlighting](language-highlight.md)
|
||||
- [Configuration](configuration.md)
|
||||
- [Themes](themes.md)
|
||||
- [List of Plugins](plugins.md)
|
||||
- [Write a Plugin](write-a-plugin.md)
|
||||
- [Markdown configuration](markdown.md)
|
||||
- [Language highlighting](language-highlight.md)
|
||||
|
||||
* Guide
|
||||
- Guide
|
||||
|
||||
* [Deploy](deploy.md)
|
||||
* [Helpers](helpers.md)
|
||||
* [Vue compatibility](vue.md)
|
||||
* [CDN](cdn.md)
|
||||
* [Offline Mode(PWA)](pwa.md)
|
||||
* [Server-Side Rendering(SSR)](ssr.md)
|
||||
* [Embed Files <sup style="color:red">(new)<sup>](embed-files.md)
|
||||
- [Deploy](deploy.md)
|
||||
- [Helpers](helpers.md)
|
||||
- [Vue compatibility](vue.md)
|
||||
- [CDN](cdn.md)
|
||||
- [Offline Mode(PWA)](pwa.md)
|
||||
- [Server-Side Rendering(SSR)](ssr.md)
|
||||
- [Embed Files](embed-files.md)
|
||||
|
||||
* [Awesome docsify](awesome.md)
|
||||
* [Changelog](changelog.md)
|
||||
- [Awesome docsify](awesome.md)
|
||||
- [Changelog](changelog.md)
|
||||
|
||||
+3
-3
@@ -26,9 +26,9 @@ Set `coverpage` to **true**, and create a `_coverpage.md`:
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
* Simple and lightweight (~19kB gzipped)
|
||||
* No statically built html files
|
||||
* Multiple themes
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- No statically built html files
|
||||
- Multiple themes
|
||||
|
||||
[GitHub](https://github.com/docsifyjs/docsify/)
|
||||
[Get Started](#docsify)
|
||||
|
||||
@@ -94,3 +94,9 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
|
||||

|
||||

|
||||

|
||||
|
||||
## Customise ID for headings
|
||||
|
||||
```md
|
||||
### 你好,世界! :id=hello-world
|
||||
```
|
||||
+6
-2
@@ -95,7 +95,7 @@ Medium's image zoom. Based on [medium-zoom](https://github.com/francoischalifour
|
||||
Exclude the special image
|
||||
|
||||
```markdown
|
||||

|
||||

|
||||
```
|
||||
|
||||
## Edit on github
|
||||
@@ -184,6 +184,10 @@ window.$docsify = {
|
||||
|
||||
A docsify.js plugin for displaying tabbed content from markdown.
|
||||
|
||||
* [Documentation & Demos](https://jhildenbiddle.github.io/docsify-tabs)
|
||||
- [Documentation & Demos](https://jhildenbiddle.github.io/docsify-tabs)
|
||||
|
||||
Provided by [@jhildenbiddle](https://github.com/jhildenbiddle/docsify-tabs).
|
||||
|
||||
## More plugins
|
||||
|
||||
See [awesome-docsify](awesome?id=plugins)
|
||||
|
||||
+131
-23
@@ -60,8 +60,6 @@ function isFn(obj) {
|
||||
return typeof obj === 'function'
|
||||
}
|
||||
|
||||
var version = "4.7.1";
|
||||
|
||||
function config () {
|
||||
var config = merge(
|
||||
{
|
||||
@@ -126,7 +124,6 @@ function config () {
|
||||
}
|
||||
}
|
||||
|
||||
config.version = version;
|
||||
window.$docsify = config;
|
||||
|
||||
return config
|
||||
@@ -337,7 +334,7 @@ function corner(data) {
|
||||
/**
|
||||
* Render main content
|
||||
*/
|
||||
function main$1(config) {
|
||||
function main(config) {
|
||||
var aside =
|
||||
'<button class="sidebar-toggle">' +
|
||||
'<div class="sidebar-toggle-button">' +
|
||||
@@ -3236,6 +3233,97 @@ var replaceSlug = cached(function (path) {
|
||||
return path.replace('#', '?id=')
|
||||
});
|
||||
|
||||
Prism.languages['markup-templating'] = {};
|
||||
|
||||
Object.defineProperties(Prism.languages['markup-templating'], {
|
||||
buildPlaceholders: {
|
||||
// Tokenize all inline templating expressions matching placeholderPattern
|
||||
// If the replaceFilter function is provided, it will be called with every match.
|
||||
// If it returns false, the match will not be replaced.
|
||||
value: function (env, language, placeholderPattern, replaceFilter) {
|
||||
if (env.language !== language) {
|
||||
return;
|
||||
}
|
||||
|
||||
env.tokenStack = [];
|
||||
|
||||
env.code = env.code.replace(placeholderPattern, function(match) {
|
||||
if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
|
||||
return match;
|
||||
}
|
||||
var i = env.tokenStack.length;
|
||||
// Check for existing strings
|
||||
while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1)
|
||||
{ ++i; }
|
||||
|
||||
// Create a sparse array
|
||||
env.tokenStack[i] = match;
|
||||
|
||||
return '___' + language.toUpperCase() + i + '___';
|
||||
});
|
||||
|
||||
// Switch the grammar to markup
|
||||
env.grammar = Prism.languages.markup;
|
||||
}
|
||||
},
|
||||
tokenizePlaceholders: {
|
||||
// Replace placeholders with proper tokens after tokenizing
|
||||
value: function (env, language) {
|
||||
if (env.language !== language || !env.tokenStack) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Switch the grammar back
|
||||
env.grammar = Prism.languages[language];
|
||||
|
||||
var j = 0;
|
||||
var keys = Object.keys(env.tokenStack);
|
||||
var walkTokens = function (tokens) {
|
||||
if (j >= keys.length) {
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
var token = tokens[i];
|
||||
if (typeof token === 'string' || (token.content && typeof token.content === 'string')) {
|
||||
var k = keys[j];
|
||||
var t = env.tokenStack[k];
|
||||
var s = typeof token === 'string' ? token : token.content;
|
||||
|
||||
var index = s.indexOf('___' + language.toUpperCase() + k + '___');
|
||||
if (index > -1) {
|
||||
++j;
|
||||
var before = s.substring(0, index);
|
||||
var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t);
|
||||
var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length);
|
||||
var replacement;
|
||||
if (before || after) {
|
||||
replacement = [before, middle, after].filter(function (v) { return !!v; });
|
||||
walkTokens(replacement);
|
||||
} else {
|
||||
replacement = middle;
|
||||
}
|
||||
if (typeof token === 'string') {
|
||||
Array.prototype.splice.apply(tokens, [i, 1].concat(replacement));
|
||||
} else {
|
||||
token.content = replacement;
|
||||
}
|
||||
|
||||
if (j >= keys.length) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (token.content && typeof token.content !== 'string') {
|
||||
walkTokens(token.content);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
walkTokens(env.tokens);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// See https://github.com/PrismJS/prism/pull/1367
|
||||
var cachedLinks = {};
|
||||
|
||||
function getAndRemoveConfig(str) {
|
||||
@@ -3245,7 +3333,8 @@ function getAndRemoveConfig(str) {
|
||||
|
||||
if (str) {
|
||||
str = str
|
||||
.replace(/^'|'$/, '')
|
||||
.replace(/^'/, '')
|
||||
.replace(/'$/, '')
|
||||
.replace(/:([\w-]+)=?([\w-]+)?/g, function (m, key, value) {
|
||||
config[key] = (value && value.replace(/"/g, '')) || true;
|
||||
return ''
|
||||
@@ -3426,26 +3515,29 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||
* @link https://github.com/markedjs/marked#overriding-renderer-methods
|
||||
*/
|
||||
origin.heading = renderer.heading = function (text, level) {
|
||||
var nextToc = {level: level, title: text};
|
||||
var ref = getAndRemoveConfig(text);
|
||||
var str = ref.str;
|
||||
var config = ref.config;
|
||||
var nextToc = {level: level, title: str};
|
||||
|
||||
if (/{docsify-ignore}/g.test(text)) {
|
||||
text = text.replace('{docsify-ignore}', '');
|
||||
nextToc.title = text;
|
||||
if (/{docsify-ignore}/g.test(str)) {
|
||||
str = str.replace('{docsify-ignore}', '');
|
||||
nextToc.title = str;
|
||||
nextToc.ignoreSubHeading = true;
|
||||
}
|
||||
|
||||
if (/{docsify-ignore-all}/g.test(text)) {
|
||||
text = text.replace('{docsify-ignore-all}', '');
|
||||
nextToc.title = text;
|
||||
if (/{docsify-ignore-all}/g.test(str)) {
|
||||
str = str.replace('{docsify-ignore-all}', '');
|
||||
nextToc.title = str;
|
||||
nextToc.ignoreAllSubs = true;
|
||||
}
|
||||
|
||||
var slug = slugify(text);
|
||||
var slug = slugify(config.id || str);
|
||||
var url = router.toURL(router.getCurrentPath(), {id: slug});
|
||||
nextToc.slug = url;
|
||||
_self.toc.push(nextToc);
|
||||
|
||||
return ("<h" + level + " id=\"" + slug + "\"><a href=\"" + url + "\" data-id=\"" + slug + "\" class=\"anchor\"><span>" + text + "</span></a></h" + level + ">")
|
||||
return ("<h" + level + " id=\"" + slug + "\"><a href=\"" + url + "\" data-id=\"" + slug + "\" class=\"anchor\"><span>" + str + "</span></a></h" + level + ">")
|
||||
};
|
||||
// Highlight code
|
||||
origin.code = renderer.code = function (code, lang) {
|
||||
@@ -3503,6 +3595,8 @@ Compiler.prototype._initRenderer = function _initRenderer () {
|
||||
result = helper('tip', text);
|
||||
} else if (/^\?>/.test(text)) {
|
||||
result = helper('warn', text);
|
||||
} else if (/^</.test(text)) {
|
||||
return text
|
||||
} else {
|
||||
result = "<p>" + text + "</p>";
|
||||
}
|
||||
@@ -3996,9 +4090,11 @@ function prerenderEmbed(ref, done) {
|
||||
var raw = ref.raw; if ( raw === void 0 ) raw = '';
|
||||
var fetch = ref.fetch;
|
||||
|
||||
var hit;
|
||||
if ((hit = cached$1[raw])) {
|
||||
return done(hit)
|
||||
var hit = cached$1[raw];
|
||||
if (hit) {
|
||||
var copy = hit.slice();
|
||||
copy.links = hit.links;
|
||||
return done(copy)
|
||||
}
|
||||
|
||||
var compile = compiler._marked;
|
||||
@@ -4154,12 +4250,12 @@ function renderMixin(proto) {
|
||||
scrollActiveSidebar(this.router);
|
||||
|
||||
if (autoHeader && activeEl) {
|
||||
var main = getNode('#main');
|
||||
var firstNode = main.children[0];
|
||||
var main$$1 = getNode('#main');
|
||||
var firstNode = main$$1.children[0];
|
||||
if (firstNode && firstNode.tagName !== 'H1') {
|
||||
var h1 = create('h1');
|
||||
h1.innerText = activeEl.innerText;
|
||||
before(main, h1);
|
||||
before(main$$1, h1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4221,9 +4317,10 @@ function renderMixin(proto) {
|
||||
toggleClass(el, 'add', 'show');
|
||||
|
||||
var html = this.coverIsHTML ? text : this.compiler.cover(text);
|
||||
|
||||
var m = html
|
||||
.trim()
|
||||
.match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$');
|
||||
.match('<img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)$');
|
||||
|
||||
if (m) {
|
||||
if (m[2] === 'color') {
|
||||
@@ -4242,6 +4339,17 @@ function renderMixin(proto) {
|
||||
html = html.replace(m[0], '');
|
||||
}
|
||||
|
||||
// XXX: A Workaround
|
||||
html = html
|
||||
.split('\n')
|
||||
.map(function (part) {
|
||||
if (/^<a/.test(part)) {
|
||||
return part.replace('<a', '<a data-button')
|
||||
}
|
||||
return part
|
||||
})
|
||||
.join('\n');
|
||||
|
||||
this._renderTo('.cover-main', html);
|
||||
sticky();
|
||||
};
|
||||
@@ -4286,7 +4394,7 @@ function initRender(vm) {
|
||||
}
|
||||
}
|
||||
|
||||
html += main$1(config);
|
||||
html += main(config);
|
||||
// Render main app
|
||||
vm._renderTo(el, html, true);
|
||||
} else {
|
||||
@@ -4952,7 +5060,7 @@ initGlobalAPI();
|
||||
/**
|
||||
* Version
|
||||
*/
|
||||
Docsify.version = '4.8.0';
|
||||
Docsify.version = '4.8.3';
|
||||
|
||||
/**
|
||||
* Run Docsify
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Generated
+1
-117
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.8.0",
|
||||
"version": "4.8.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -6811,122 +6811,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"rollup-plugin-json": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-json/-/rollup-plugin-json-3.1.0.tgz",
|
||||
"integrity": "sha512-BlYk5VspvGpjz7lAwArVzBXR60JK+4EKtPkCHouAWg39obk9S61hZYJDBfMK+oitPdoe11i69TlxKlMQNFC/Uw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"rollup-pluginutils": "^2.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"arr-diff": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz",
|
||||
"integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arr-flatten": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"array-unique": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
|
||||
"integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=",
|
||||
"dev": true
|
||||
},
|
||||
"braces": {
|
||||
"version": "1.8.5",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz",
|
||||
"integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"expand-range": "^1.8.1",
|
||||
"preserve": "^0.2.0",
|
||||
"repeat-element": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"estree-walker": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.5.2.tgz",
|
||||
"integrity": "sha512-XpCnW/AE10ws/kDAs37cngSkvgIR8aN3G0MS85m7dUpuK2EREo9VJ00uvw6Dg/hXEpfsE1I1TvJOJr+Z+TL+ig==",
|
||||
"dev": true
|
||||
},
|
||||
"expand-brackets": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz",
|
||||
"integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-posix-bracket": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"extglob": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz",
|
||||
"integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extglob": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-extglob": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz",
|
||||
"integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=",
|
||||
"dev": true
|
||||
},
|
||||
"is-glob": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz",
|
||||
"integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extglob": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"kind-of": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
|
||||
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-buffer": "^1.1.5"
|
||||
}
|
||||
},
|
||||
"micromatch": {
|
||||
"version": "2.3.11",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz",
|
||||
"integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arr-diff": "^2.0.0",
|
||||
"array-unique": "^0.2.1",
|
||||
"braces": "^1.8.2",
|
||||
"expand-brackets": "^0.1.4",
|
||||
"extglob": "^0.3.1",
|
||||
"filename-regex": "^2.0.0",
|
||||
"is-extglob": "^1.0.0",
|
||||
"is-glob": "^2.0.1",
|
||||
"kind-of": "^3.0.2",
|
||||
"normalize-path": "^2.0.1",
|
||||
"object.omit": "^2.0.0",
|
||||
"parse-glob": "^3.0.4",
|
||||
"regex-cache": "^0.4.2"
|
||||
}
|
||||
},
|
||||
"rollup-pluginutils": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz",
|
||||
"integrity": "sha512-2XZwja7b6P5q4RZ5FhyX1+f46xi1Z3qBKigLRZ6VTZjwbN0K1IFGMlwm06Uu0Emcre2Z63l77nq/pzn+KxIEoA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"estree-walker": "^0.5.2",
|
||||
"micromatch": "^2.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rollup-plugin-node-resolve": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.4.0.tgz",
|
||||
|
||||
+2
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.8.0",
|
||||
"version": "4.8.3",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
@@ -45,7 +45,7 @@
|
||||
"marked": "^0.5.1",
|
||||
"medium-zoom": "^0.4.0",
|
||||
"opencollective": "^1.0.3",
|
||||
"prismjs": "^1.9.0",
|
||||
"prismjs": "^1.15.0",
|
||||
"tinydate": "^1.0.0",
|
||||
"tweezer.js": "^1.4.0"
|
||||
},
|
||||
@@ -65,7 +65,6 @@
|
||||
"rollup-plugin-async": "^1.2.0",
|
||||
"rollup-plugin-buble": "^0.18.0",
|
||||
"rollup-plugin-commonjs": "^8.2.6",
|
||||
"rollup-plugin-json": "^3.1.0",
|
||||
"rollup-plugin-node-resolve": "^3.0.0",
|
||||
"rollup-plugin-replace": "^2.0.0",
|
||||
"rollup-plugin-uglify": "^2.0.1",
|
||||
|
||||
+1
-1
@@ -37,5 +37,5 @@
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.8.0"
|
||||
"version": "4.8.3"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.8.0",
|
||||
"version": "4.8.3",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
@@ -16,6 +16,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^2.6.8",
|
||||
"docsify": "^4.8.0",
|
||||
"node-fetch": "^1.7.0",
|
||||
"resolve-pathname": "^2.1.0"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {merge, hyphenate, isPrimitive, hasOwn} from './util/core'
|
||||
import {version as pkgVersion} from './../../package.json'
|
||||
|
||||
export default function () {
|
||||
const config = merge(
|
||||
@@ -65,7 +64,6 @@ export default function () {
|
||||
}
|
||||
}
|
||||
|
||||
config.version = pkgVersion
|
||||
window.$docsify = config
|
||||
|
||||
return config
|
||||
|
||||
+17
-10
@@ -7,6 +7,9 @@ import {emojify} from './emojify'
|
||||
import {isAbsolutePath, getPath, getParentPath} from '../router/util'
|
||||
import {isFn, merge, cached, isPrimitive} from '../util/core'
|
||||
|
||||
// See https://github.com/PrismJS/prism/pull/1367
|
||||
import 'prismjs/components/prism-markup-templating'
|
||||
|
||||
const cachedLinks = {}
|
||||
|
||||
export function getAndRemoveConfig(str = '') {
|
||||
@@ -14,7 +17,8 @@ export function getAndRemoveConfig(str = '') {
|
||||
|
||||
if (str) {
|
||||
str = str
|
||||
.replace(/^'|'$/, '')
|
||||
.replace(/^'/, '')
|
||||
.replace(/'$/, '')
|
||||
.replace(/:([\w-]+)=?([\w-]+)?/g, (m, key, value) => {
|
||||
config[key] = (value && value.replace(/"/g, '')) || true
|
||||
return ''
|
||||
@@ -189,26 +193,27 @@ export class Compiler {
|
||||
* @link https://github.com/markedjs/marked#overriding-renderer-methods
|
||||
*/
|
||||
origin.heading = renderer.heading = function (text, level) {
|
||||
const nextToc = {level, title: text}
|
||||
let {str, config} = getAndRemoveConfig(text)
|
||||
const nextToc = {level, title: str}
|
||||
|
||||
if (/{docsify-ignore}/g.test(text)) {
|
||||
text = text.replace('{docsify-ignore}', '')
|
||||
nextToc.title = text
|
||||
if (/{docsify-ignore}/g.test(str)) {
|
||||
str = str.replace('{docsify-ignore}', '')
|
||||
nextToc.title = str
|
||||
nextToc.ignoreSubHeading = true
|
||||
}
|
||||
|
||||
if (/{docsify-ignore-all}/g.test(text)) {
|
||||
text = text.replace('{docsify-ignore-all}', '')
|
||||
nextToc.title = text
|
||||
if (/{docsify-ignore-all}/g.test(str)) {
|
||||
str = str.replace('{docsify-ignore-all}', '')
|
||||
nextToc.title = str
|
||||
nextToc.ignoreAllSubs = true
|
||||
}
|
||||
|
||||
const slug = slugify(text)
|
||||
const slug = slugify(config.id || str)
|
||||
const url = router.toURL(router.getCurrentPath(), {id: slug})
|
||||
nextToc.slug = url
|
||||
_self.toc.push(nextToc)
|
||||
|
||||
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${text}</span></a></h${level}>`
|
||||
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${str}</span></a></h${level}>`
|
||||
}
|
||||
// Highlight code
|
||||
origin.code = renderer.code = function (code, lang = '') {
|
||||
@@ -260,6 +265,8 @@ export class Compiler {
|
||||
result = helperTpl('tip', text)
|
||||
} else if (/^\?>/.test(text)) {
|
||||
result = helperTpl('warn', text)
|
||||
} else if (/^</.test(text)) {
|
||||
return text
|
||||
} else {
|
||||
result = `<p>${text}</p>`
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ function walkFetchEmbed({embedTokens, compile, fetch}, cb) {
|
||||
]
|
||||
embedToken.links = {}
|
||||
} else {
|
||||
embedToken = [{type: 'html', text: text}]
|
||||
embedToken = [{type: 'html', text}]
|
||||
embedToken.links = {}
|
||||
}
|
||||
}
|
||||
@@ -57,9 +57,11 @@ function walkFetchEmbed({embedTokens, compile, fetch}, cb) {
|
||||
}
|
||||
|
||||
export function prerenderEmbed({compiler, raw = '', fetch}, done) {
|
||||
let hit
|
||||
if ((hit = cached[raw])) {
|
||||
return done(hit)
|
||||
let hit = cached[raw]
|
||||
if (hit) {
|
||||
const copy = hit.slice()
|
||||
copy.links = hit.links
|
||||
return done(copy)
|
||||
}
|
||||
|
||||
const compile = compiler._marked
|
||||
|
||||
@@ -176,9 +176,10 @@ export function renderMixin(proto) {
|
||||
dom.toggleClass(el, 'add', 'show')
|
||||
|
||||
let html = this.coverIsHTML ? text : this.compiler.cover(text)
|
||||
|
||||
const m = html
|
||||
.trim()
|
||||
.match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$')
|
||||
.match('<img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)$')
|
||||
|
||||
if (m) {
|
||||
if (m[2] === 'color') {
|
||||
@@ -197,6 +198,17 @@ export function renderMixin(proto) {
|
||||
html = html.replace(m[0], '')
|
||||
}
|
||||
|
||||
// XXX: A Workaround
|
||||
html = html
|
||||
.split('\n')
|
||||
.map(part => {
|
||||
if (/^<a/.test(part)) {
|
||||
return part.replace('<a', '<a data-button')
|
||||
}
|
||||
return part
|
||||
})
|
||||
.join('\n')
|
||||
|
||||
this._renderTo('.cover-main', html)
|
||||
sticky()
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ section.cover
|
||||
max-width 500px
|
||||
padding 0
|
||||
|
||||
.cover-main > p:last-child a
|
||||
.cover-main > a[data-button]
|
||||
border-color var(--theme-color, $color-primary)
|
||||
border-radius 2rem
|
||||
border-style solid
|
||||
|
||||
Reference in New Issue
Block a user