Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Legacy bugs (styles, site plugin error, and dev server error) #1743

Merged
merged 18 commits into from
Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.DS_Store
.idea
*.log
_playwright-report
_playwright-results
lib
node_modules
themes
/_playwright-report
/_playwright-results
/lib
/node_modules
/themes

# exceptions
!.gitkeep
42 changes: 19 additions & 23 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<body>
<div id="app">Loading ...</div>
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1/index.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to update index.html?

<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1/index.min.js"></script>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. :)

Done.

<script>
// Set html "lang" attribute based on URL
var lang = location.hash.match(/#\/(de-de|es|ru-ru|zh-cn)\//);
Expand Down Expand Up @@ -118,21 +118,21 @@
'/zh-cn/': '搜索',
'/': 'Search',
},
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn']
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn'],
},
vueComponents: {
'button-counter': {
template:
'<button @click="count += 1">You clicked me {{ count }} times</button>',
data: function() {
data: function () {
return {
count: 0,
};
},
},
},
vueGlobalOptions: {
data: function() {
data: function () {
return {
count: 0,
message: 'Hello, World!',
Expand All @@ -145,7 +145,7 @@
};
},
computed: {
timeOfDay: function() {
timeOfDay: function () {
const date = new Date();
const hours = date.getHours();

Expand All @@ -159,14 +159,14 @@
},
},
methods: {
hello: function() {
hello: function () {
alert(this.message);
},
},
},
vueMounts: {
'#counter': {
data: function() {
data: function () {
return {
count: 0,
};
Expand All @@ -175,8 +175,8 @@
},
plugins: [
DocsifyCarbon.create('CEBI6KQE', 'docsifyjsorg'),
function(hook, vm) {
hook.beforeEach(function(html) {
function (hook, vm) {
hook.beforeEach(function (html) {
if (/githubusercontent\.com/.test(vm.route.file)) {
url = vm.route.file
.replace('raw.githubusercontent.com', 'github.com')
Expand All @@ -198,7 +198,7 @@
'<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>'
);
}),
hook.afterEach(function(html) {
hook.afterEach(function (html) {
if (vm.route.path === '/') {
return html;
}
Expand All @@ -218,19 +218,15 @@
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-nginx.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-php.min.js"></script>
<script>
(function() {
function loadJS(src, attrs) {
document.write(
'<script src="' + src + '" ' + (attrs || '') + '><\/script>'
);
}

// Public site only
if (/docsify/.test(location.host)) {
loadJS('//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/ga.min.js');
loadJS('//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/matomo.min.js');
}
})();
// Public site only
if (/docsify/.test(location.host)) {
document.write(
'<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/ga.min.js"><\/script>'
);
document.write(
'<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/matomo.min.js"><\/script>'
);
}
</script>
<script src="//cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script>
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script> -->
Expand Down
25 changes: 19 additions & 6 deletions src/core/init/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,27 @@ export function Lifecycle(Base) {
if (index >= queue.length) {
next(data);
} else if (typeof hookFn === 'function') {
const errTitle = `Docsify plugin error (${hookName})`;

if (hookFn.length === 2) {
hookFn(data, result => {
data = result;
step(index + 1);
});
try {
hookFn(data, result => {
data = result;
});
} catch (err) {
console.error(errTitle, err);
sy-records marked this conversation as resolved.
Show resolved Hide resolved
}

step(index + 1);
} else {
const result = hookFn(data);
data = result === undefined ? data : result;
try {
const result = hookFn(data);

data = result === undefined ? data : data;
} catch (err) {
console.error(errTitle, err);
}

step(index + 1);
}
} else {
Expand Down
5 changes: 5 additions & 0 deletions src/themes/basic/_coverpage.styl
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ section.cover
padding 0

.cover-main > p:last-child a
border-color $color-primary
border-color var(--theme-color, $color-primary)
border-radius 2rem
border-style solid
border-width 1px
box-sizing border-box
color $color-primary
color var(--theme-color, $color-primary)
display inline-block
font-size 1.05rem
Expand All @@ -78,6 +80,7 @@ section.cover
transition all 0.15s ease

&:last-child
background-color $color-primary
background-color var(--theme-color, $color-primary)
color #fff

Expand All @@ -89,8 +92,10 @@ section.cover
color inherit

blockquote > p > a
border-bottom 2px solid $color-primary
border-bottom 2px solid var(--theme-color, $color-primary)
transition color 0.3s

&:hover
color $color-primary
color var(--theme-color, $color-primary)
8 changes: 8 additions & 0 deletions src/themes/basic/_layout.styl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ div#app
vertical-align middle

.progress
background-color $color-primary
background-color var(--theme-color, $color-primary)
height 2px
left 0px
Expand All @@ -37,9 +38,11 @@ div#app
z-index 999999

.search a:hover
color $color-primary
color var(--theme-color, $color-primary)

.search .search-keyword
color $color-primary
color var(--theme-color, $color-primary)
font-style normal
font-weight bold
Expand Down Expand Up @@ -108,10 +111,13 @@ li input[type='checkbox']
transition color 0.3s

&:hover
color $color-primary
color var(--theme-color, $color-primary)

&.active
border-bottom 2px solid $color-primary
border-bottom 2px solid var(--theme-color, $color-primary)
color $color-primary
color var(--theme-color, $color-primary)

/* navbar dropdown */
Expand Down Expand Up @@ -172,6 +178,7 @@ li input[type='checkbox']

svg
color $color-bg
fill $color-primary
fill var(--theme-color, $color-primary)
height 80px
width 80px
Expand Down Expand Up @@ -284,6 +291,7 @@ main.hidden
opacity 0.4

span
background-color $color-primary
background-color var(--theme-color, $color-primary)
display block
margin-bottom 4px
Expand Down
2 changes: 2 additions & 0 deletions src/themes/buble.styl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ $sidebar-width = 16rem
font-weight 600

.markdown-section a
color $color-primary
color var(--theme-color, $color-primary)

.markdown-section p, .markdown-section ul, .markdown-section ol
Expand Down Expand Up @@ -83,6 +84,7 @@ $sidebar-width = 16rem
margin 0

.markdown-section blockquote
border-left 4px solid $color-primary
border-left 4px solid var(--theme-color, $color-primary)
color #858585
margin 2em 0
Expand Down
5 changes: 5 additions & 0 deletions src/themes/dark.styl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ body
padding 0

ul li.active > a
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand All @@ -43,6 +44,7 @@ body
font-weight 600

.markdown-section a
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand Down Expand Up @@ -79,6 +81,7 @@ body
padding-left 1.5rem

.markdown-section blockquote
border-left 4px solid $color-primary
border-left 4px solid var(--theme-color, $color-primary)
color #858585
margin 2em 0
Expand Down Expand Up @@ -138,6 +141,7 @@ body
color #2973b7

.token.string
color $color-primary
color var(--theme-color, $color-primary)

.token.selector
Expand All @@ -150,6 +154,7 @@ body
color #22a2c9

.token.attr-value, .token.control, .token.directive, .token.unit
color $color-primary
color var(--theme-color, $color-primary)

.token.keyword
Expand Down
7 changes: 6 additions & 1 deletion src/themes/dolphin.styl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ body

ul li.active > a
border-right 2px solid
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand All @@ -52,9 +53,10 @@ body
font-weight 600

.markdown-section a
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

&:hover
text-decoration underline

Expand Down Expand Up @@ -91,6 +93,7 @@ body
padding-left 1.5rem

.markdown-section blockquote
border-left 4px solid $color-primary
border-left 4px solid var(--theme-color, $color-primary)
color #858585
margin 2em 0
Expand Down Expand Up @@ -150,6 +153,7 @@ body
color #2973b7

.token.string
color $color-primary
color var(--theme-color, $color-primary)

.token.selector
Expand All @@ -162,6 +166,7 @@ body
color #22a2c9

.token.attr-value, .token.control, .token.directive, .token.unit
color $color-primary
color var(--theme-color, $color-primary)

.token.keyword, .token.function
Expand Down
5 changes: 5 additions & 0 deletions src/themes/vue.styl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ body

ul li.active > a
border-right 2px solid
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand All @@ -52,6 +53,7 @@ body
font-weight 600

.markdown-section a
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand Down Expand Up @@ -88,6 +90,7 @@ body
padding-left 1.5rem

.markdown-section blockquote
border-left 4px solid $color-primary
border-left 4px solid var(--theme-color, $color-primary)
color #858585
margin 2em 0
Expand Down Expand Up @@ -204,6 +207,7 @@ body
color #2973b7

.token.string
color $color-primary
color var(--theme-color, $color-primary)

.token.selector
Expand All @@ -216,6 +220,7 @@ body
color #22a2c9

.token.attr-value, .token.control, .token.directive, .token.unit
color $color-primary
color var(--theme-color, $color-primary)

.token.keyword, .token.function
Expand Down
Loading