From c2cf54bee519b0041248e8d8bf711f7e3d243000 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:41:16 +0800 Subject: [PATCH 1/6] chore: bump husky from 8.0.3 to 9.0.11 (#2382) Bumps [husky](https://github.com/typicode/husky) from 8.0.3 to 9.0.11. - [Release notes](https://github.com/typicode/husky/releases) - [Commits](https://github.com/typicode/husky/compare/v8.0.3...v9.0.11) --- updated-dependencies: - dependency-name: husky dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index d8ebddbe0..52401e1ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "eslint-plugin-playwright": "^0.16.0", "eslint-plugin-prettier": "^4.2.1", "globals": "^13.20.0", - "husky": "^8.0.3", + "husky": "^9.0.11", "jest": "^27.4.7", "lint-staged": "^13.2.2", "mkdirp": "^3.0.0", @@ -7681,15 +7681,15 @@ } }, "node_modules/husky": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", - "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "version": "9.0.11", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", + "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", "dev": true, "bin": { - "husky": "lib/bin.js" + "husky": "bin.mjs" }, "engines": { - "node": ">=14" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/typicode" diff --git a/package.json b/package.json index 98eb97210..54efbff52 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "eslint-plugin-playwright": "^0.16.0", "eslint-plugin-prettier": "^4.2.1", "globals": "^13.20.0", - "husky": "^8.0.3", + "husky": "^9.0.11", "jest": "^27.4.7", "lint-staged": "^13.2.2", "mkdirp": "^3.0.0", From 9e681c6419c6243a64308db195444274ed8342f0 Mon Sep 17 00:00:00 2001 From: "Bingzhi.Li" <46718060+LBZZYZ@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:37:28 +0800 Subject: [PATCH 2/6] chore: fix front matter broken (#2390) Co-authored-by: Luffy <52o@qq52o.cn> --- docs/_media/example-with-yaml.md | 2 +- docs/embed-files.md | 2 ++ docs/index.html | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/_media/example-with-yaml.md b/docs/_media/example-with-yaml.md index 081bedde2..bfb280d74 100644 --- a/docs/_media/example-with-yaml.md +++ b/docs/_media/example-with-yaml.md @@ -3,4 +3,4 @@ author: John Smith date: 2020-1-1 --- -> This is from the `example.md` +> This is from the `example-with-yaml.md` diff --git a/docs/embed-files.md b/docs/embed-files.md index f06d121f8..60172d8ae 100644 --- a/docs/embed-files.md +++ b/docs/embed-files.md @@ -44,6 +44,8 @@ You will get: ## Markdown with YAML Front Matter +Front Matter, commonly utilized in blogging systems like Jekyll, serves to define metadata for a document. The [front-matter.js](https://www.npmjs.com/package/front-matter) package facilitates the extraction of metadata (front matter) from documents. + When using Markdown, YAML front matter will be stripped from the rendered content. The attributes cannot be used in this case. ```markdown diff --git a/docs/index.html b/docs/index.html index 4b2a50996..dcd533488 100644 --- a/docs/index.html +++ b/docs/index.html @@ -219,6 +219,7 @@ + From 87fd55d7125539b929f3260fca92e666e988b6da Mon Sep 17 00:00:00 2001 From: Luffy <52o@qq52o.cn> Date: Tue, 26 Mar 2024 08:19:31 +0800 Subject: [PATCH 3/6] fix: carbon broken (#2387) --- docs/index.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/index.html b/docs/index.html index dcd533488..0a7f78140 100644 --- a/docs/index.html +++ b/docs/index.html @@ -187,9 +187,7 @@ }, }, plugins: [ - function () { - DocsifyCarbon.create('CEBI6KQE', 'docsifyjsorg'); - }, + DocsifyCarbon.create('CEBI6KQE', 'docsifyjsorg'), function (hook, vm) { hook.beforeEach(html => { if (/githubusercontent\.com/.test(vm.route.file)) { From a3ab2be0b070a1bacc4fec3c2d2f0ffe279bada0 Mon Sep 17 00:00:00 2001 From: John Hildenbiddle Date: Fri, 12 Apr 2024 23:17:45 -0500 Subject: [PATCH 4/6] fix: prevent unnecessary themeColor deprecation notice (#2403) --- src/core/config.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/core/config.js b/src/core/config.js index 9d9f8e31d..e3a191157 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -47,17 +47,19 @@ export default function (vm) { return this.__themeColor; }, set themeColor(value) { - this.__themeColor = value; - console.warn( - stripIndent(/* html */ ` - $docsify.themeColor is deprecated. Use a --theme-color property in your style sheet. Example: - - `).trim() - ); + if (value) { + this.__themeColor = value; + console.warn( + stripIndent(` + $docsify.themeColor is deprecated. Use a --theme-color property in your style sheet. Example: + + `).trim() + ); + } }, }, From 947d8decb8c5c62f3ce50d0c6ac0e27bb6c7a6b5 Mon Sep 17 00:00:00 2001 From: John Hildenbiddle Date: Tue, 16 Apr 2024 22:52:48 -0500 Subject: [PATCH 5/6] fix: dev mode hot reload and add sourcemaps (#2402) --------- Co-authored-by: Koy Zhuang Co-authored-by: sy-records <52o@qq52o.cn> --- build/build.js | 41 ++++++++++++++++++++--------------------- build/mincss.js | 2 +- server.configs.js | 2 ++ 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/build/build.js b/build/build.js index c8b9ab545..ceb5d7ae7 100644 --- a/build/build.js +++ b/build/build.js @@ -3,8 +3,8 @@ import { promises as fs } from 'fs'; import * as rollup from 'rollup'; import commonjs from '@rollup/plugin-commonjs'; import nodeResolve from '@rollup/plugin-node-resolve'; -import uglify from '@rollup/plugin-terser'; import replace from '@rollup/plugin-replace'; +import terser from '@rollup/plugin-terser'; import chokidar from 'chokidar'; import { relative } from './util.js'; @@ -54,6 +54,7 @@ async function build(opts) { output: opts.globalName ? { name: opts.globalName } : {}, file: dest, strict: false, + sourcemap: opts.sourcemap, }); }); } @@ -68,15 +69,14 @@ async function buildCore() { }) ); - 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: [terser()], + sourcemap: true, + }) + ); await Promise.all(promises); } @@ -102,17 +102,16 @@ async function buildAllPlugin() { }); }); - if (isProd) { - plugins.forEach(item => { - promises.push( - build({ - input: 'src/plugins/' + item.input, - output: 'plugins/' + item.name + '.min.js', - plugins: [uglify()], - }) - ); - }); - } + plugins.forEach(item => { + promises.push( + build({ + input: 'src/plugins/' + item.input, + output: 'plugins/' + item.name + '.min.js', + plugins: [terser()], + sourcemap: true, + }) + ); + }); await Promise.all(promises); } diff --git a/build/mincss.js b/build/mincss.js index 3d480c1d8..45c0dc173 100644 --- a/build/mincss.js +++ b/build/mincss.js @@ -9,7 +9,7 @@ const files = fs files.forEach(file => { file = path.resolve('lib/themes', file); cssnano - .process(fs.readFileSync(file)) + .process(fs.readFileSync(file), { from: file }) .then(result => { file = file.replace(/\.css$/, '.min.css'); fs.writeFileSync(file, result.css); diff --git a/server.configs.js b/server.configs.js index 2f0889c72..0360bd6a7 100644 --- a/server.configs.js +++ b/server.configs.js @@ -24,6 +24,8 @@ export const devConfig = { files: ['CHANGELOG.md', 'docs/**/*', 'lib/**/*'], port: 3000, rewriteRules, + reloadDebounce: 1000, + reloadOnRestart: true, server: { ...prodConfig.server, routes: { From 2d986feb34fcdb2a2731cff7b29b0a4d0563787e Mon Sep 17 00:00:00 2001 From: John Hildenbiddle Date: Wed, 17 Apr 2024 01:58:00 -0500 Subject: [PATCH 6/6] fix: skip-to-content scroll behavior (#2401) --- src/core/event/index.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/core/event/index.js b/src/core/event/index.js index 6df41a83a..aa6ddae7e 100644 --- a/src/core/event/index.js +++ b/src/core/event/index.js @@ -31,7 +31,7 @@ export function Events(Base) { // Move focus to content if (query.id || source === 'navigate') { - this.focusContent(); + this.#focusContent(); } if (loadNavbar) { @@ -139,19 +139,15 @@ export function Events(Base) { #enableScrollEvent = true; #coverHeight = 0; - #skipLink(el) { - el = dom.getNode(el); - - if (el === null || el === undefined) { - return; - } - - dom.on(el, 'click', evt => { - const target = dom.getNode('#main'); + #skipLink(elm) { + elm = typeof elm === 'string' ? dom.find(elm) : elm; + elm?.addEventListener('click', evt => { evt.preventDefault(); - target && target.focus(); - this.#scrollTo(target); + dom.getNode('main')?.scrollIntoView({ + behavior: 'smooth', + }); + this.#focusContent({ preventScroll: true }); }); } @@ -177,7 +173,7 @@ export function Events(Base) { .begin(); } - focusContent() { + #focusContent(options = {}) { const { query } = this.route; const focusEl = query.id ? // Heading ID @@ -188,7 +184,7 @@ export function Events(Base) { dom.find('#main'); // Move focus to content area - focusEl && focusEl.focus(); + focusEl && focusEl.focus(options); } #highlight(path) {