diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index cde218821..81a77b7e3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,44 +1,53 @@ --- name: Bug report -about: Create a report to help us improve - +about: Create a report to help us fix an issue --- - - - - - + + ## Bug Report #### Steps to reproduce + + +#### Current behaviour + -#### What is current behaviour +#### Expected behaviour + +#### Other relevant information -#### What is the expected behaviour +- Docsify version: + +- [ ] Bug still occurs when all/other plugins are disabled? -#### Other relevant information +- Docsify plugins (if the bug happens when plugins enabled, please try to isolate the issue): + + -- [ ] Bug does still occur when all/other plugins are disabled? +- Your OS: +- Node.js version: +- npm/yarn version: +- Browser version: -- Your OS: -- Node.js version: -- npm/yarn version: -- Browser version: -- Docsify version: -- Docsify plugins: +--> - + -#### Please create a reproducible sandbox +#### Please create a reproducible sandbox [![Edit 307qqv236](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/307qqv236) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 83f0826c6..b0afe139b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - name: Discord - the community chat - url: https://discord.gg/3NwKFyR - about: Join Discord community and chat about Docsify + url: https://discord.gg/docsify + about: Join the Discord community and chat about Docsify diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 501e4de50..cb840f656 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,25 +1,32 @@ --- name: Feature request about: Suggest an idea for this project - --- - - - - - -## Feature request - -#### What problem does this feature solve? + +## Feature request -#### What does the proposed API look like? +#### Problem or desire + +#### Proposal -#### How should this be implemented in your opinion? + +#### Implementation + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4e6fad009..95fa8289e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,31 +1,25 @@ -## **Summary** +## Summary - +## Related issue, if any: -## **What kind of change does this PR introduce?** + - +## What kind of change does this PR introduce? - -## **For any code change,** +## For any code change, -- [ ] Related documentation has been updated if needed -- [ ] Related tests have been updated or tests have been added + -## **Does this PR introduce a breaking change?** (check one) +- [ ] Related documentation has been updated, if needed +- [ ] Related tests have been added or updated, if needed -- [ ] Yes -- [ ] No +## Does this PR introduce a breaking change? (pick one) -If yes, please describe the impact and migration path for existing applications: +Yes +No -## **Related issue, if any:** - - + -## **Tested in the following browsers:** +## Tested in the following browsers: - [ ] Chrome - [ ] Firefox diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6c246b1d0..affcf763a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,12 +6,12 @@ version: 2 updates: - package-ecosystem: npm # See documentation for possible values - directory: "/" # Location of package manifests + directory: '/' # Location of package manifests open-pull-requests-limit: 10 schedule: - interval: "weekly" - - package-ecosystem: "github-actions" - directory: "/" + interval: 'weekly' + - package-ecosystem: 'github-actions' + directory: '/' open-pull-requests-limit: 10 schedule: interval: monthly diff --git a/.gitpod.yml b/.gitpod.yml index 8113b45a4..41805e3e7 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -7,4 +7,4 @@ ports: onOpen: ignore vscode: extensions: - - sysoev.language-stylus@1.11.0:xX39oruAJ5UQzTNVRdbBaQ== \ No newline at end of file + - sysoev.language-stylus@1.11.0:xX39oruAJ5UQzTNVRdbBaQ== diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..6c424db81 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +CHANGELOG.md +HISTORY.md +lib/ +themes/ +_playwright-*/ +emoji-data.* diff --git a/HISTORY.md b/HISTORY.md index fb720fddd..b5abee65d 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,4 @@ + ## [3.7.3](https://github.com/QingWei-Li/docsify/compare/v3.7.2...v3.7.3) (2017-05-22) diff --git a/README.md b/README.md index 8c665fc5a..f49c7d536 100644 --- a/README.md +++ b/README.md @@ -62,12 +62,12 @@ Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase) ## Similar projects -| Project | Description | -| ------------------------------------------------ | ---------------------------------------- | -| [Docusaurus](https://docusaurus.io) | Docusaurus makes it easy to maintain Open Source documentation websites | -| [GitBook](https://www.gitbook.com) | Where technical teams document | -| [MkDocs](https://www.mkdocs.org) | Project documentation with Markdown | -| [VuePress](https://vuepress.vuejs.org) | Vue-powered Static Site Generator | +| Project | Description | +| -------------------------------------- | ----------------------------------------------------------------------- | +| [Docusaurus](https://docusaurus.io) | Docusaurus makes it easy to maintain Open Source documentation websites | +| [GitBook](https://www.gitbook.com) | Where technical teams document | +| [MkDocs](https://www.mkdocs.org) | Project documentation with Markdown | +| [VuePress](https://vuepress.vuejs.org) | Vue-powered Static Site Generator | ## Contributing diff --git a/SECURITY.md b/SECURITY.md index 1b9f6f908..f57d273a0 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,7 +6,7 @@ If you believe you have found a security vulnerability in docsify, please report **Please do not report security vulnerabilities through our public GitHub issues.** -Send email via :email: maintainers@docsifyjs.org to us. +Send email to us via :email: maintainers@docsifyjs.org. Please include as much of the following information as possible to help us better understand the possible issue: diff --git a/build/build.js b/build/build.js index 6a3726ed5..eb03b80ed 100644 --- a/build/build.js +++ b/build/build.js @@ -32,83 +32,89 @@ async function build(opts) { nodeResolve(), replace({ __VERSION__: version, - }) + }), ], onwarn(message) { if (message.code === 'UNRESOLVED_IMPORT') { throw new Error( `Could not resolve module ` + - message.source + - `. Try running 'npm install' or using rollup's 'external' option if this is an external dependency. ` + - `Module ${message.source} is imported in ${message.importer}` - ) + message.source + + `. Try running 'npm install' or using rollup's 'external' option if this is an external dependency. ` + + `Module ${message.source} is imported in ${message.importer}` + ); } - } + }, }) .then(bundle => { - const dest = 'lib/' + (opts.output || opts.input) + const dest = 'lib/' + (opts.output || opts.input); - console.log(dest) + console.log(dest); return bundle.write({ format: 'iife', - output: opts.globalName ? {name: opts.globalName} : {}, + output: opts.globalName ? { name: opts.globalName } : {}, file: dest, - strict: false - }) - }) + strict: false, + }); + }); } async function buildCore() { - const promises = [] + const promises = []; - promises.push(build({ - input: 'src/core/index.js', - output: 'docsify.js', - })) + promises.push( + build({ + input: 'src/core/index.js', + output: 'docsify.js', + }) + ); if (isProd) { - promises.push(build({ - input: 'src/core/index.js', - output: 'docsify.min.js', - plugins: [uglify()] - })) + promises.push( + build({ + input: 'src/core/index.js', + output: 'docsify.min.js', + plugins: [uglify()], + }) + ); } - await Promise.all(promises) + await Promise.all(promises); } async function buildAllPlugin() { const plugins = [ - {name: 'search', input: 'search/index.js'}, - {name: 'ga', input: 'ga.js'}, - {name: 'gtag', input: 'gtag.js'}, - {name: 'matomo', input: 'matomo.js'}, - {name: 'emoji', input: 'emoji.js'}, - {name: 'external-script', input: 'external-script.js'}, - {name: 'front-matter', input: 'front-matter/index.js'}, - {name: 'zoom-image', input: 'zoom-image.js'}, - {name: 'disqus', input: 'disqus.js'}, - {name: 'gitalk', input: 'gitalk.js'} - ] + { name: 'search', input: 'search/index.js' }, + { name: 'ga', input: 'ga.js' }, + { name: 'gtag', input: 'gtag.js' }, + { name: 'matomo', input: 'matomo.js' }, + { name: 'emoji', input: 'emoji.js' }, + { name: 'external-script', input: 'external-script.js' }, + { name: 'front-matter', input: 'front-matter/index.js' }, + { name: 'zoom-image', input: 'zoom-image.js' }, + { name: 'disqus', input: 'disqus.js' }, + { name: 'gitalk', input: 'gitalk.js' }, + ]; const promises = plugins.map(item => { return build({ input: 'src/plugins/' + item.input, - output: 'plugins/' + item.name + '.js' - }) - }) + output: 'plugins/' + item.name + '.js', + }); + }); if (isProd) { plugins.forEach(item => { - promises.push(build({ - input: 'src/plugins/' + item.input, - output: 'plugins/' + item.name + '.min.js', - plugins: [uglify()] - })) - }) + promises.push( + build({ + input: 'src/plugins/' + item.input, + output: 'plugins/' + item.name + '.min.js', + plugins: [uglify()], + }) + ); + }); } - await Promise.all(promises) + await Promise.all(promises); } async function main() { @@ -118,41 +124,37 @@ async function main() { atomic: true, awaitWriteFinish: { stabilityThreshold: 1000, - pollInterval: 100 - } + pollInterval: 100, + }, }) .on('change', p => { - console.log('[watch] ', p) - const dirs = p.split(path.sep) + console.log('[watch] ', p); + const dirs = p.split(path.sep); if (dirs[1] === 'core') { - buildCore() + buildCore(); } else if (dirs[2]) { - const name = path.basename(dirs[2], '.js') + const name = path.basename(dirs[2], '.js'); const input = `src/plugins/${name}${ /\.js/.test(dirs[2]) ? '' : '/index' - }.js` + }.js`; build({ input, - output: 'plugins/' + name + '.js' - }) + output: 'plugins/' + name + '.js', + }); } }) .on('ready', () => { - console.log('[start]') - buildCore() - buildAllPlugin() - }) + console.log('[start]'); + buildCore(); + buildAllPlugin(); + }); } else { - await Promise.all([ - buildCore(), - buildAllPlugin() - ]) + await Promise.all([buildCore(), buildAllPlugin()]); } } -main().catch((e) => { - console.error(e) - process.exit(1) -}) - +main().catch(e => { + console.error(e); + process.exit(1); +}); diff --git a/build/css.js b/build/css.js index 1047c5868..71a9dc947 100644 --- a/build/css.js +++ b/build/css.js @@ -1,47 +1,48 @@ -import fs from 'fs' -import path from 'path' -import {spawn} from 'child_process' +import fs from 'fs'; +import path from 'path'; +import { spawn } from 'child_process'; const relative = path => new URL(path, import.meta.url); -const args = process.argv.slice(2) +const args = process.argv.slice(2); fs.readdir(relative('../src/themes'), (err, files) => { - if (err) { - console.error('err', err) - process.exit(1) - } - files.map(async (file) => { - if (/\.styl/g.test(file)) { - const stylusBin = ['node_modules', 'stylus', 'bin', 'stylus'].join(path.sep) - let cmdargs = [ - stylusBin, - `src/themes/${file}`, - '-u', - 'autoprefixer-stylus' - ] - cmdargs = [...cmdargs, ...args] + if (err) { + console.error('err', err); + process.exit(1); + } + files.map(async file => { + if (/\.styl/g.test(file)) { + const stylusBin = ['node_modules', 'stylus', 'bin', 'stylus'].join( + path.sep + ); + let cmdargs = [ + stylusBin, + `src/themes/${file}`, + '-u', + 'autoprefixer-stylus', + ]; + cmdargs = [...cmdargs, ...args]; - const stylusCMD = spawn('node', cmdargs, { shell: true }) + const stylusCMD = spawn('node', cmdargs, { shell: true }); - stylusCMD.stdout.on('data', (data) => { - console.log(`[Stylus Build ] stdout: ${data}`); - }); + stylusCMD.stdout.on('data', data => { + console.log(`[Stylus Build ] stdout: ${data}`); + }); - stylusCMD.stderr.on('data', (data) => { - console.error(`[Stylus Build ] stderr: ${data}`); - }); + stylusCMD.stderr.on('data', data => { + console.error(`[Stylus Build ] stderr: ${data}`); + }); - stylusCMD.on('close', (code) => { - const message = `[Stylus Build ] child process exited with code ${code}` + stylusCMD.on('close', code => { + const message = `[Stylus Build ] child process exited with code ${code}`; - if (code !== 0) { - console.error(message); - process.exit(code) - } - console.log(message); - }); - } else { - return + if (code !== 0) { + console.error(message); + process.exit(code); } - - }) -}) + console.log(message); + }); + } else { + return; + } + }); +}); diff --git a/build/mincss.js b/build/mincss.js index 05b8d770e..3e4206066 100644 --- a/build/mincss.js +++ b/build/mincss.js @@ -1,15 +1,18 @@ import cssnano from 'cssnano'; -import path from 'path' -import fs from 'fs' +import path from 'path'; +import fs from 'fs'; -const files = fs.readdirSync(path.resolve('lib/themes')) +const files = fs.readdirSync(path.resolve('lib/themes')); files.forEach(file => { - file = path.resolve('lib/themes', file) - cssnano.process(fs.readFileSync(file)).then(result => { - fs.writeFileSync(file, result.css) - }).catch(e => { - console.error(e) - process.exit(1) - }) -}) + file = path.resolve('lib/themes', file); + cssnano + .process(fs.readFileSync(file)) + .then(result => { + fs.writeFileSync(file, result.css); + }) + .catch(e => { + console.error(e); + process.exit(1); + }); +}); diff --git a/docs/_media/example.html b/docs/_media/example.html index d35ee1624..9820b4c1e 100644 --- a/docs/_media/example.html +++ b/docs/_media/example.html @@ -1 +1 @@ -