mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-19 02:06:08 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
168d8475d5 | ||
|
|
7ba434e61d | ||
|
|
8cd386ae49 | ||
|
|
8c7e4d7866 | ||
|
|
cbaee21ded |
@@ -1,3 +1,8 @@
|
|||||||
|
## 2.0.3
|
||||||
|
### Bug fixes
|
||||||
|
- fix: rendering emojis
|
||||||
|
- fix: css var polyfill
|
||||||
|
|
||||||
## 2.0.2
|
## 2.0.2
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
# docsify <small>2.0.2</small>
|
# docsify <small>2.0.3</small>
|
||||||
|
|
||||||
> A magical documentation site generator.
|
> A magical documentation site generator.
|
||||||
|
|
||||||
|
|||||||
+12
-8
@@ -170,6 +170,7 @@ var merge = Object.assign || function (to) {
|
|||||||
|
|
||||||
function emojify (text) {
|
function emojify (text) {
|
||||||
return text
|
return text
|
||||||
|
.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, function (match) { return match.replace(/:/g, '__colon__'); })
|
||||||
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
||||||
.replace(/__colon__/g, ':')
|
.replace(/__colon__/g, ':')
|
||||||
}
|
}
|
||||||
@@ -2509,14 +2510,17 @@ function cssVars () {
|
|||||||
if (block.nodeName === 'STYLE') {
|
if (block.nodeName === 'STYLE') {
|
||||||
replaceVar(block);
|
replaceVar(block);
|
||||||
} else if (block.nodeName === 'LINK') {
|
} else if (block.nodeName === 'LINK') {
|
||||||
load(block.getAttribute('href'))
|
var href = block.getAttribute('href');
|
||||||
.then(function (res) {
|
|
||||||
var style = document.createElement('style');
|
|
||||||
|
|
||||||
style.innerHTML = res;
|
if (!/\.css$/.test(href)) { return }
|
||||||
document.head.appendChild(style);
|
|
||||||
replaceVar(style);
|
load(href).then(function (res) {
|
||||||
});
|
var style = document.createElement('style');
|
||||||
|
|
||||||
|
style.innerHTML = res;
|
||||||
|
document.head.appendChild(style);
|
||||||
|
replaceVar(style);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2557,7 +2561,7 @@ function init () {
|
|||||||
|
|
||||||
var hl = prism.highlight(code, prism.languages[lang] || prism.languages.markup);
|
var hl = prism.highlight(code, prism.languages[lang] || prism.languages.markup);
|
||||||
|
|
||||||
return ("<pre v-pre data-lang=\"" + lang + "\"><code class=\"lang-" + lang + "\">" + (hl.replace(/:/g, '__colon__')) + "</code></pre>")
|
return ("<pre v-pre data-lang=\"" + lang + "\"><code class=\"lang-" + lang + "\">" + hl + "</code></pre>")
|
||||||
};
|
};
|
||||||
renderer.link = function (href, title, text) {
|
renderer.link = function (href, title, text) {
|
||||||
if (!/:/.test(href)) {
|
if (!/:/.test(href)) {
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "docsify",
|
"name": "docsify",
|
||||||
"version": "2.0.2",
|
"version": "2.0.3",
|
||||||
"description": "A magical documentation generator.",
|
"description": "A magical documentation generator.",
|
||||||
"main": "lib/docsify.js",
|
"main": "lib/docsify.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
+10
-7
@@ -14,14 +14,17 @@ export function cssVars () {
|
|||||||
if (block.nodeName === 'STYLE') {
|
if (block.nodeName === 'STYLE') {
|
||||||
replaceVar(block)
|
replaceVar(block)
|
||||||
} else if (block.nodeName === 'LINK') {
|
} else if (block.nodeName === 'LINK') {
|
||||||
load(block.getAttribute('href'))
|
const href = block.getAttribute('href')
|
||||||
.then(res => {
|
|
||||||
const style = document.createElement('style')
|
|
||||||
|
|
||||||
style.innerHTML = res
|
if (!/\.css$/.test(href)) return
|
||||||
document.head.appendChild(style)
|
|
||||||
replaceVar(style)
|
load(href).then(res => {
|
||||||
})
|
const style = document.createElement('style')
|
||||||
|
|
||||||
|
style.innerHTML = res
|
||||||
|
document.head.appendChild(style)
|
||||||
|
replaceVar(style)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ export function init () {
|
|||||||
renderer.code = function (code, lang = '') {
|
renderer.code = function (code, lang = '') {
|
||||||
const hl = Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)
|
const hl = Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)
|
||||||
|
|
||||||
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl.replace(/:/g, '__colon__')}</code></pre>`
|
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
|
||||||
}
|
}
|
||||||
renderer.link = function (href, title, text) {
|
renderer.link = function (href, title, text) {
|
||||||
if (!/:/.test(href)) {
|
if (!/:/.test(href)) {
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ export const merge = Object.assign || function (to) {
|
|||||||
|
|
||||||
export function emojify (text) {
|
export function emojify (text) {
|
||||||
return text
|
return text
|
||||||
|
.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, match => match.replace(/:/g, '__colon__'))
|
||||||
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
||||||
.replace(/__colon__/g, ':')
|
.replace(/__colon__/g, ':')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user