@umijs/plugin-docs 4.0.0-rc.15 → 4.0.0-rc.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
|
-
import { history } from 'umi';
|
|
3
2
|
import { useThemeContext } from './context';
|
|
4
3
|
|
|
5
4
|
interface useLanguageResult {
|
|
@@ -11,7 +10,7 @@ interface useLanguageResult {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
function useLanguage(): useLanguageResult {
|
|
14
|
-
const { themeConfig, location } = useThemeContext()!;
|
|
13
|
+
const { themeConfig, location, history } = useThemeContext()!;
|
|
15
14
|
|
|
16
15
|
const languages = themeConfig.i18n;
|
|
17
16
|
let currentLanguage: { locale: string; text: string } | undefined = undefined;
|
package/dist/compiler.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.compile = void 0;
|
|
7
|
-
const plugin_utils_1 = require("umi/plugin-utils");
|
|
8
7
|
const rehype_pretty_code_1 = __importDefault(require("rehype-pretty-code"));
|
|
8
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
9
9
|
// @ts-ignore
|
|
10
10
|
const mdx_1 = require("../compiled/@mdx-js/mdx");
|
|
11
11
|
// @ts-ignore
|
|
@@ -48,8 +48,11 @@ function MDXContent(props = {}) {
|
|
|
48
48
|
|
|
49
49
|
useEffect(() => {
|
|
50
50
|
if (window.location.hash.length !== 0) {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
// 为了右侧内容区能正常跳转
|
|
52
|
+
const hash = decodeURIComponent(window.location.hash);
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
document.getElementById(hash.slice(1))?.scrollIntoView();
|
|
55
|
+
}, 100);
|
|
53
56
|
} else {
|
|
54
57
|
window.scrollTo(0, 0);
|
|
55
58
|
}
|
package/dist/index.js
CHANGED
|
@@ -125,7 +125,7 @@ export { ${exports
|
|
|
125
125
|
path: 'Layout.tsx',
|
|
126
126
|
content: `
|
|
127
127
|
import React from 'react';
|
|
128
|
-
import { useOutlet, useAppData, useLocation, Link } from 'umi';
|
|
128
|
+
import { useOutlet, useAppData, useLocation, Link, history } from 'umi';
|
|
129
129
|
import { $Layout as Layout } from '${(0, utils_1.winPath)(require.resolve('../client/theme-doc/index.ts'))}';
|
|
130
130
|
${themeExists
|
|
131
131
|
? `import themeConfig from '${themeConfigPath}'`
|
|
@@ -138,7 +138,7 @@ export default () => {
|
|
|
138
138
|
const appData = useAppData();
|
|
139
139
|
const location = useLocation();
|
|
140
140
|
return (
|
|
141
|
-
<Layout appData={appData} components={{Link}} themeConfig={themeConfig} location={location}>
|
|
141
|
+
<Layout appData={appData} components={{Link}} themeConfig={themeConfig} location={location} history={history}>
|
|
142
142
|
<div>{ outlet }</div>
|
|
143
143
|
</Layout>
|
|
144
144
|
);
|
package/dist/markdown.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseTitle = void 0;
|
|
4
4
|
function parseTitle(opts) {
|
|
5
|
-
const lines = opts.content
|
|
5
|
+
const lines = opts.content
|
|
6
|
+
.replace(/{[\n\s\t]*\/\*[\s\S]*?\*\/[\n\s\t]*}/g, '')
|
|
7
|
+
.split('\n');
|
|
6
8
|
let i = 0;
|
|
7
9
|
const ret = [];
|
|
8
10
|
while (i < lines.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugin-docs",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.16",
|
|
4
4
|
"description": "@umijs/plugin-docs",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/plugin-docs#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"keymaster": "1.6.2",
|
|
30
30
|
"react-helmet": "^6.1.0",
|
|
31
|
-
"rehype-pretty-code": "^0.3.
|
|
31
|
+
"rehype-pretty-code": "^0.3.1",
|
|
32
32
|
"shiki": "^0.10.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"classnames": "^2.3.1",
|
|
39
39
|
"rehype-slug": "5.0.1",
|
|
40
40
|
"remark-gfm": "^3.0.1",
|
|
41
|
-
"tailwindcss": "^3.0.
|
|
42
|
-
"umi": "4.0.0-rc.
|
|
41
|
+
"tailwindcss": "^3.0.24",
|
|
42
|
+
"umi": "4.0.0-rc.16"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|