Skip to content

Commit

Permalink
Merge branch 'develop' into feat-target
Browse files Browse the repository at this point in the history
  • Loading branch information
Koooooo-7 committed Apr 20, 2024
2 parents bb2d838 + 2d986fe commit 6464167
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 58 deletions.
41 changes: 20 additions & 21 deletions build/build.js
Expand Up @@ -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';

Expand Down Expand Up @@ -54,6 +54,7 @@ async function build(opts) {
output: opts.globalName ? { name: opts.globalName } : {},
file: dest,
strict: false,
sourcemap: opts.sourcemap,
});
});
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion build/mincss.js
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion docs/_media/example-with-yaml.md
Expand Up @@ -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`
2 changes: 2 additions & 0 deletions docs/embed-files.md
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions docs/index.html
Expand Up @@ -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)) {
Expand Down Expand Up @@ -219,6 +217,7 @@
</script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/front-matter.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/ga.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/matomo.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions server.configs.js
Expand Up @@ -24,6 +24,8 @@ export const devConfig = {
files: ['CHANGELOG.md', 'docs/**/*', 'lib/**/*'],
port: 3000,
rewriteRules,
reloadDebounce: 1000,
reloadOnRestart: true,
server: {
...prodConfig.server,
routes: {
Expand Down
24 changes: 13 additions & 11 deletions src/core/config.js
Expand Up @@ -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:
<style>
:root {
--theme-color: deeppink;
}
</style>
`).trim()
);
if (value) {
this.__themeColor = value;
console.warn(
stripIndent(`
$docsify.themeColor is deprecated. Use a --theme-color property in your style sheet. Example:
<style>
:root {
--theme-color: deeppink;
}
</style>
`).trim()
);
}
},
},

Expand Down
24 changes: 10 additions & 14 deletions src/core/event/index.js
Expand Up @@ -31,7 +31,7 @@ export function Events(Base) {

// Move focus to content
if (query.id || source === 'navigate') {
this.focusContent();
this.#focusContent();
}

if (loadNavbar) {
Expand Down Expand Up @@ -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 });
});
}

Expand All @@ -177,7 +173,7 @@ export function Events(Base) {
.begin();
}

focusContent() {
#focusContent(options = {}) {
const { query } = this.route;
const focusEl = query.id
? // Heading ID
Expand All @@ -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) {
Expand Down

0 comments on commit 6464167

Please sign in to comment.