Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Commit be1d491

Browse files
author
Sujaykumar Hublikar
committed
format plugin
add customPageTitle to log and error comment unwanted hook method
1 parent a998d62 commit be1d491

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

src/plugin.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,31 @@
1616

1717
// config options
1818
const customPageTitleOptions = {
19-
prefix: false,
20-
suffix: false,
21-
seprator: '|',
22-
debug: false,
19+
prefix: false,
20+
suffix: false,
21+
seprator: '|',
22+
debug: false,
2323
}
2424

2525
// main function
26-
function customPageTitle( hook, vm ) {
26+
function customPageTitle(hook, vm) {
2727

28-
// before hook
29-
hook.beforeEach( function( content ) {
30-
});
28+
// before hook
29+
// hook.beforeEach(function (content) {
30+
// });
3131

3232
// after hook
33-
hook.doneEach( function() {
34-
var _title = document.title; // title from docsify
33+
hook.doneEach(function () {
34+
var _title = document.title; // title from docsify
3535

3636
debug('customPageTitleOptions: ' + customPageTitleOptions);
3737
debug('page title [before]: ' + document.title);
38-
if(customPageTitleOptions.prefix != '' || customPageTitleOptions.prefix != false){
38+
if (customPageTitleOptions.prefix != '' || customPageTitleOptions.prefix != false) {
3939
_title = customPageTitleOptions.prefix + " " + customPageTitleOptions.seprator + " " + _title;
4040
debug('new title [prefix]:' + _title);
4141
}
4242

43-
if(customPageTitleOptions.suffix != '' || customPageTitleOptions.suffix != false){
43+
if (customPageTitleOptions.suffix != '' || customPageTitleOptions.suffix != false) {
4444
_title = _title + " " + customPageTitleOptions.seprator + " " + customPageTitleOptions.suffix;
4545
debug('new title [suffix]:' + _title);
4646
}
@@ -49,23 +49,23 @@ function customPageTitle( hook, vm ) {
4949
});
5050
}
5151

52-
function debug(msg){
53-
if(customPageTitleOptions.debug) console.log(msg);
52+
function debug(msg) {
53+
if (customPageTitleOptions.debug) console.log('[customPageTitle] log: ' + msg);
5454
}
5555

56-
function error(msg){
57-
if(customPageTitleOptions.debug) console.error(msg);
56+
function error(msg) {
57+
if (customPageTitleOptions.debug) console.error('[customPageTitle] err: ' + msg);
5858
}
5959

6060

6161
// find customPageTitle plugin options
6262
window.$docsify.customPageTitle = Object.assign(
63-
customPageTitleOptions,
64-
window.$docsify.customPageTitle
63+
customPageTitleOptions,
64+
window.$docsify.customPageTitle
6565
);
6666

6767
// Set docsify plugin
6868
window.$docsify.plugins = [].concat(
69-
customPageTitle,
70-
window.$docsify.plugins
69+
customPageTitle,
70+
window.$docsify.plugins
7171
);

0 commit comments

Comments
 (0)