@umijs/plugin-docs 4.0.0-rc.8 → 4.0.1

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,6 @@
1
1
  import cx from 'classnames';
2
2
  import React from 'react';
3
+ import { useThemeContext } from './context';
3
4
  import Github from './Github';
4
5
  import LangSwitch from './LangSwitch';
5
6
  import Logo from './Logo';
@@ -13,27 +14,41 @@ interface HeadProps {
13
14
  }
14
15
 
15
16
  export default (props: HeadProps) => {
17
+ const { themeConfig } = useThemeContext()!;
16
18
  return (
17
19
  <div
18
20
  className="w-full flex flex-row items-center justify-between
19
- border-b-gray-100 border-b-2 pt-4 pb-4 px-8 dark:border-b-gray-800"
21
+ border-b-gray-100 border-b-2 pt-4 pb-4 px-4 lg:px-12 dark:border-b-gray-800"
20
22
  >
21
- <Logo />
23
+ <div className="flex flex-row items-center">
24
+ <Logo />
25
+ {themeConfig.extraNavLeft && <themeConfig.extraNavLeft />}
26
+ </div>
22
27
  <div className="flex flex-row items-center">
23
28
  <Search />
24
- <HamburgerButton {...props} />
29
+ {/* 小屏幕显示打开菜单的按钮 */}
30
+ <div
31
+ className="block lg:hidden ml-2 cursor-pointer"
32
+ onClick={() => props.setMenuOpened((o) => !o)}
33
+ >
34
+ <HamburgerButton {...props} />
35
+ </div>
36
+ {/* 大屏幕显示完整的操作按钮 */}
25
37
  <div className="hidden lg:block">
26
38
  <NavBar />
27
39
  </div>
28
40
  <div className="ml-4 hidden lg:block">
29
41
  <LangSwitch />
30
42
  </div>
31
- <div className="ml-4 hidden lg:block">
32
- <ThemeSwitch />
33
- </div>
43
+ {themeConfig.themeSwitch && (
44
+ <div className="ml-4 hidden lg:block">
45
+ <ThemeSwitch />
46
+ </div>
47
+ )}
34
48
  <div className="ml-4 hidden lg:block">
35
49
  <Github />
36
50
  </div>
51
+ {themeConfig.extraNavRight && <themeConfig.extraNavRight />}
37
52
  </div>
38
53
  </div>
39
54
  );
@@ -41,30 +56,27 @@ export default (props: HeadProps) => {
41
56
 
42
57
  interface HamburgerButtonProps {
43
58
  isMenuOpened: boolean;
44
- setMenuOpened: React.Dispatch<React.SetStateAction<boolean>>;
45
59
  }
46
60
 
47
61
  function HamburgerButton(props: HamburgerButtonProps) {
62
+ const { isMenuOpened } = props;
48
63
  const barClass =
49
- 'block absolute h-0.5 w-5 bg-current transform dark:bg-white' +
50
- ' transition duration-500 ease-in-out';
64
+ 'absolute h-0.5 w-5 -translate-x-2.5 bg-current transform dark:bg-white ' +
65
+ 'transition duration-500 ease-in-out';
51
66
 
52
67
  return (
53
- <div
54
- className="relative py-3 sm:max-w-xl mx-auto mx-5 lg:hidden"
55
- onClick={() => props.setMenuOpened((o) => !o)}
56
- >
68
+ <div className="p-4">
57
69
  <span
58
70
  className={cx(
59
71
  barClass,
60
- props.isMenuOpened ? 'rotate-45 ' : '-translate-y-1.5',
72
+ isMenuOpened ? 'rotate-45 ' : '-translate-y-1.5',
61
73
  )}
62
74
  />
63
- <span className={cx(barClass, props.isMenuOpened && 'opacity-0')} />
75
+ <span className={cx(barClass, isMenuOpened && 'opacity-0')} />
64
76
  <span
65
77
  className={cx(
66
78
  barClass,
67
- props.isMenuOpened ? '-rotate-45' : 'translate-y-1.5',
79
+ isMenuOpened ? '-rotate-45' : 'translate-y-1.5',
68
80
  )}
69
81
  />
70
82
  </div>
@@ -17,7 +17,7 @@ export default () => {
17
17
  }
18
18
 
19
19
  function handleClick() {
20
- if (!currentLanguage) return;
20
+ if (!currentLanguage || languages.length === 1) return;
21
21
  if (languages.length === 2) {
22
22
  switchLanguage(
23
23
  languages[0].locale === currentLanguage.locale
@@ -29,6 +29,8 @@ export default () => {
29
29
  setExpanded((e) => !e);
30
30
  }
31
31
 
32
+ if (!currentLanguage || languages.length === 1) return null;
33
+
32
34
  return (
33
35
  <div>
34
36
  <div
@@ -20,7 +20,8 @@ export default (props: any) => {
20
20
 
21
21
  function updateBlur() {
22
22
  if (!offset || !blur) return;
23
- blur.backgroundPosition = `0px ` + `${-window.scrollY + 100}px`;
23
+ blur.backgroundPosition =
24
+ `0px ` + `calc(var(--anchor-offset) + ${-window.scrollY + 64}px)`;
24
25
  }
25
26
 
26
27
  document.addEventListener('scroll', updateBlur, false), updateBlur();
@@ -42,9 +43,13 @@ export default (props: any) => {
42
43
  components: props.components,
43
44
  themeConfig: props.themeConfig,
44
45
  location: props.location,
46
+ history: props.history,
45
47
  }}
46
48
  >
47
- <div className="flex flex-col dark:bg-gray-900 min-h-screen transition-all">
49
+ <div
50
+ className="flex flex-col dark:bg-gray-900 min-h-screen transition-all"
51
+ id={isHomePage ? 'home-page' : 'doc-page'}
52
+ >
48
53
  <div
49
54
  id="head-container"
50
55
  className="z-30 sticky top-0 dark:before:bg-gray-800 before:bg-white before:bg-opacity-[.85]
@@ -60,6 +65,7 @@ export default (props: any) => {
60
65
 
61
66
  {isHomePage ? (
62
67
  <div id="article-body">
68
+ {/* @ts-ignore */}
63
69
  <Helmet>
64
70
  <title>
65
71
  {title}
@@ -74,31 +80,32 @@ export default (props: any) => {
74
80
  id="article-body"
75
81
  className="w-full flex flex-row justify-center overflow-x-hidden"
76
82
  >
77
- <div className="container flex flex-row justify-center">
78
- <div className="w-full lg:w-1/2 px-4 lg:px-2 m-8 z-20 lg:py-12">
79
- <article className="flex-1">{props.children}</article>
83
+ {/* 左侧菜单 */}
84
+ <div
85
+ className="fixed left-0 top-0 w-1/4 flex flex-row
86
+ justify-center h-screen z-10 pt-20"
87
+ >
88
+ <div className="container flex flex-row justify-end">
89
+ <div className="hidden lg:block">
90
+ <Sidebar />
91
+ </div>
80
92
  </div>
81
93
  </div>
82
- </div>
83
-
84
- <div
85
- className="fixed left-0 top-0 w-1/4 flex flex-row
86
- justify-center h-screen z-10 pt-20"
87
- >
88
- <div className="container flex flex-row justify-end">
89
- <div className="hidden lg:block">
90
- <Sidebar />
94
+ {/* 文章内容 */}
95
+ <div className="container flex flex-row justify-center">
96
+ <div className="w-full lg:w-1/2 px-4 lg:px-2 m-8 z-20 lg:pb-12 lg:pt-6">
97
+ <article className="flex-1">{props.children}</article>
91
98
  </div>
92
99
  </div>
93
- </div>
94
-
95
- <div
96
- className="fixed right-0 top-0 w-1/4 flex flex-row
97
- justify-center h-screen z-10 pt-20 hidden lg:block"
98
- >
99
- <div className="container flex flex-row justify-start">
100
- <div className="w-2/3 top-32">
101
- <Toc />
100
+ {/* 右侧 Toc */}
101
+ <div
102
+ className="fixed right-0 top-0 w-1/4 hidden lg:block flex-row
103
+ justify-center h-screen z-10 pt-20"
104
+ >
105
+ <div className="container flex flex-row justify-start">
106
+ <div className="w-2/3 top-32">
107
+ <Toc />
108
+ </div>
102
109
  </div>
103
110
  </div>
104
111
  </div>
@@ -109,7 +116,7 @@ export default (props: any) => {
109
116
  <div
110
117
  className={cx(
111
118
  'fixed top-12 w-screen bg-white z-20 dark:bg-gray-800',
112
- 'overflow-hidden transition-all duration-500',
119
+ 'overflow-hidden transition-all duration-500 lg:hidden',
113
120
  isMenuOpened ? 'max-h-screen' : 'max-h-0',
114
121
  )}
115
122
  >
@@ -5,15 +5,19 @@ import useLanguage from './useLanguage';
5
5
  export default () => {
6
6
  const { themeConfig, components } = useThemeContext()!;
7
7
  const { isFromPath, currentLanguage } = useLanguage();
8
-
9
- // @ts-ignore
10
- const { logo } = themeConfig;
8
+ const Logo = themeConfig.logo;
11
9
 
12
10
  return (
13
11
  <components.Link to={isFromPath ? '/' + currentLanguage?.locale : '/'}>
14
12
  <div className="flex flex-row items-center">
15
- <img src={logo} className="w-8 h-8" alt="logo" />
16
- <div className="text-xl font-extrabold ml-2 dark:text-white">
13
+ {typeof Logo === 'string' && (
14
+ <img src={Logo} className="w-8 h-8" alt="logo" />
15
+ )}
16
+ {typeof Logo === 'function' && <Logo />}
17
+ <div
18
+ id="header-title"
19
+ className="text-xl font-extrabold ml-2 dark:text-white"
20
+ >
17
21
  {themeConfig.title}
18
22
  </div>
19
23
  </div>
@@ -1,27 +1,106 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { useThemeContext } from './context';
3
+ import ExternalLink from './icons/link.svg';
3
4
  import useLanguage from './useLanguage';
4
5
 
5
6
  export default () => {
6
- const { components, themeConfig } = useThemeContext()!;
7
- const lang = useLanguage();
7
+ const { themeConfig } = useThemeContext()!;
8
8
  return (
9
9
  <ul className="flex">
10
- {themeConfig.navs.map((nav: any) => {
11
- return (
12
- <li key={nav.path} className="ml-4 dark:text-white">
13
- <components.Link
14
- to={
15
- lang.isFromPath
16
- ? lang.currentLanguage?.locale + nav.path
17
- : nav.path
18
- }
19
- >
20
- {lang.render(nav.title)}
21
- </components.Link>
22
- </li>
23
- );
24
- })}
10
+ {themeConfig.navs.map((nav: any) => (
11
+ <NavItem nav={nav} key={nav.path} />
12
+ ))}
25
13
  </ul>
26
14
  );
27
15
  };
16
+
17
+ interface NavItemProps {
18
+ nav: {
19
+ path: string;
20
+ title: string;
21
+ type?: 'nav' | 'link';
22
+ dropdown?: {
23
+ title: string;
24
+ path: string;
25
+ }[];
26
+ };
27
+ }
28
+
29
+ function NavItem(props: NavItemProps) {
30
+ const { components } = useThemeContext()!;
31
+ const { nav } = props;
32
+ const lang = useLanguage();
33
+ const [isExpanded, setExpanded] = useState(false);
34
+
35
+ const isExternalLink = (n: NavItemProps['nav']) => {
36
+ return (
37
+ n.type === 'link' && /(https|http):\/\/([\w.]+\/?)\S*/.test(nav.path)
38
+ );
39
+ };
40
+
41
+ return (
42
+ <li
43
+ className="ml-8 dark:text-white relative"
44
+ onMouseEnter={() => nav.dropdown && setExpanded(true)}
45
+ onMouseLeave={() => nav.dropdown && setExpanded(false)}
46
+ >
47
+ {isExternalLink(nav) ? (
48
+ <a href={nav.path} target="_blank">
49
+ <span className="flex">
50
+ {nav.title}
51
+ <img src={ExternalLink} alt="ExternalLink" />
52
+ </span>
53
+ </a>
54
+ ) : (
55
+ <components.Link
56
+ to={
57
+ lang.isFromPath ? lang.currentLanguage?.locale + nav.path : nav.path
58
+ }
59
+ >
60
+ {lang.render(nav.title)}
61
+ </components.Link>
62
+ )}
63
+ {nav.dropdown && (
64
+ <div
65
+ style={{ maxHeight: isExpanded ? nav.dropdown.length * 48 : 0 }}
66
+ className="absolute transition-all duration-300 w-32 rounded-lg
67
+ cursor-pointer shadow overflow-hidden top-8"
68
+ >
69
+ {nav.dropdown.map((n) => (
70
+ <>
71
+ {isExternalLink(n) ? (
72
+ <a href={n.path} target="_blank">
73
+ <span className="flex">
74
+ <span
75
+ className="p-2 bg-white dark:bg-gray-700 dark:text-white
76
+ hover:bg-gray-50 transition duration-300"
77
+ >
78
+ {nav.title}
79
+ </span>
80
+ <img src={ExternalLink} alt="ExternalLink" />
81
+ </span>
82
+ </a>
83
+ ) : (
84
+ <components.Link
85
+ key={n.path}
86
+ to={
87
+ lang.isFromPath
88
+ ? lang.currentLanguage?.locale + n.path
89
+ : n.path
90
+ }
91
+ >
92
+ <p
93
+ className="p-2 bg-white dark:bg-gray-700 dark:text-white
94
+ hover:bg-gray-50 transition duration-300"
95
+ >
96
+ {n.title}
97
+ </p>
98
+ </components.Link>
99
+ )}
100
+ </>
101
+ ))}
102
+ </div>
103
+ )}
104
+ </li>
105
+ );
106
+ }
@@ -3,9 +3,11 @@ import key from 'keymaster';
3
3
  import React, { Fragment, useEffect, useState } from 'react';
4
4
  import { useThemeContext } from './context';
5
5
  import useLanguage from './useLanguage';
6
+ import getLinkFromTitle from './utils/getLinkFromTitle';
6
7
 
7
8
  export default () => {
8
- const { render } = useLanguage();
9
+ const { components } = useThemeContext()!;
10
+ const { isFromPath, currentLanguage, render } = useLanguage();
9
11
  const [isFocused, setIsFocused] = useState(false);
10
12
  const [keyword, setKeyword] = useState('');
11
13
 
@@ -34,6 +36,7 @@ export default () => {
34
36
  }
35
37
 
36
38
  useEffect(() => {
39
+ if (!themeConfig.searchHotKey) return;
37
40
  key.filter = () => true;
38
41
 
39
42
  // 在页面中按下 ⌘+k 可以打开搜索框
@@ -63,6 +66,7 @@ export default () => {
63
66
  return (
64
67
  <Fragment>
65
68
  <div
69
+ id="search-input-wrapper"
66
70
  className="rounded-lg w-40 lg:w-64 flex items-center pr-2 flex-row hover:bg-gray-50
67
71
  transition duration-300 bg-gray-100 border border-white focus-within:border-gray-100
68
72
  focus-within:bg-white dark:bg-gray-700 dark:border-gray-700 relative
@@ -72,28 +76,43 @@ export default () => {
72
76
  onFocus={() => setIsFocused(true)}
73
77
  onBlur={() => setIsFocused(false)}
74
78
  value={keyword}
79
+ autoComplete="off"
75
80
  onChange={(e) => setKeyword(e.target.value)}
76
81
  id="search-input"
77
- className="w-full bg-transparent outline-none text-sm px-4 py-2 "
82
+ className="w-full bg-transparent outline-none text-sm px-4 py-2"
78
83
  placeholder={render('Search anything ...')}
79
84
  />
80
- <div
81
- className="bg-gray-200 rounded px-2 h-6 flex flex-row text-gray-400
85
+ {themeConfig.searchHotKey && (
86
+ <div
87
+ className="bg-gray-200 rounded px-2 h-6 flex flex-row text-gray-400
82
88
  items-center justify-center border border-gray-300 text-xs"
83
- >
84
- {isMac ? macSearchKey : windowsSearchKey}
85
- </div>
89
+ >
90
+ {isMac ? macSearchKey : windowsSearchKey}
91
+ </div>
92
+ )}
86
93
  <div
94
+ id="search-results-wrapper"
87
95
  className={cx(
88
96
  'absolute transition-all duration-500 top-12 w-96 rounded-lg',
89
97
  'cursor-pointer shadow overflow-hidden',
90
- result.length > 0 && isFocused ? 'max-h-80' : 'max-h-0',
98
+ keyword && isFocused ? 'max-h-80' : 'max-h-0',
91
99
  )}
92
100
  >
101
+ {keyword && result.length === 0 && (
102
+ <div>
103
+ <p
104
+ className="p-2 bg-white hover:bg-gray-50 transition
105
+ duration-300 group-focus:bg-blue-200 dark:bg-gray-700"
106
+ >
107
+ {render('No result for')} "{keyword}"
108
+ </p>
109
+ </div>
110
+ )}
93
111
  {result.map((r, i) => (
94
- <a
95
- href={r.href}
112
+ <components.Link
113
+ to={(isFromPath ? currentLanguage?.locale : '') + r.href}
96
114
  key={i}
115
+ onClick={() => (document.activeElement as HTMLElement)?.blur()}
97
116
  className="group outline-none search-result"
98
117
  onFocus={() => setIsFocused(true)}
99
118
  onBlur={() => setIsFocused(false)}
@@ -104,7 +123,7 @@ export default () => {
104
123
  >
105
124
  {r.path}
106
125
  </p>
107
- </a>
126
+ </components.Link>
108
127
  ))}
109
128
  </div>
110
129
  </div>
@@ -122,9 +141,15 @@ function search(routes: any, keyword: string): SearchResultItem[] {
122
141
 
123
142
  const result: SearchResultItem[] = [];
124
143
 
144
+ function addResult(newResult: { path: string; href: string }) {
145
+ const { path, href } = newResult;
146
+ if (result.find((r) => r.path === path)) return;
147
+ result.push({ path, href });
148
+ }
149
+
125
150
  Object.keys(routes).map((path) => {
126
151
  if (path.toLowerCase().includes(keyword.toLowerCase())) {
127
- result.push({
152
+ addResult({
128
153
  path: path.split('/').slice(1).join(' > '),
129
154
  href: '/' + path,
130
155
  });
@@ -132,16 +157,21 @@ function search(routes: any, keyword: string): SearchResultItem[] {
132
157
 
133
158
  const route = routes[path];
134
159
  if (!route.titles) return;
135
- route.titles
136
- .filter((t: any) => t.level <= 2)
137
- .map((title: any) => {
138
- if (title.title.toLowerCase().includes(keyword.toLowerCase())) {
139
- result.push({
140
- path: path.split('/').slice(1).join(' > ') + ' > ' + title.title,
141
- href: '/' + path + '#' + title.title,
142
- });
143
- }
144
- });
160
+ route.titles.map((title: any) => {
161
+ if (title.title.toLowerCase().includes(keyword.toLowerCase())) {
162
+ addResult({
163
+ path:
164
+ path
165
+ .split('/')
166
+ .map((s) => s.replace(/\.[a-z]{2}-[A-Z]{2}\/?/g, ''))
167
+ .slice(1)
168
+ .join(' > ') +
169
+ ' > ' +
170
+ title.title,
171
+ href: '/' + path + '#' + getLinkFromTitle(title.title),
172
+ });
173
+ }
174
+ });
145
175
  });
146
176
 
147
177
  if (result.length > 8) return result.slice(0, 8);
@@ -28,7 +28,7 @@ export default (props: SidebarProps) => {
28
28
  <ul
29
29
  className={cx(
30
30
  'h-screen lg:h-[calc(100vh-8rem)] overflow-y-scroll',
31
- 'lg:w-64 p-8 pb-12 fadeout w-full',
31
+ 'lg:w-64 px-8 pt-12 lg:pt-8 pb-36 fadeout w-full',
32
32
  )}
33
33
  >
34
34
  {(matchedNav.children || []).map((item) => {
@@ -49,7 +49,8 @@ export default (props: SidebarProps) => {
49
49
  if (to === window.location.pathname) {
50
50
  return (
51
51
  <div
52
- key={child}
52
+ id="active-nav-item"
53
+ key={route.path}
53
54
  className="my-2 hover:text-blue-400 transition-all
54
55
  bg-blue-50 text-blue-400 px-4 py-1
55
56
  rounded-lg cursor-default dark:bg-blue-900 dark:text-blue-200"
@@ -61,7 +62,9 @@ export default (props: SidebarProps) => {
61
62
 
62
63
  return (
63
64
  <components.Link
64
- to={route.path}
65
+ key={route.path}
66
+ to={to.startsWith('/') ? to : `/${to}`}
67
+ prefetch
65
68
  onClick={() =>
66
69
  props.setMenuOpened && props.setMenuOpened((o) => !o)
67
70
  }
@@ -1,12 +1,20 @@
1
1
  import cx from 'classnames';
2
2
  import React, { useEffect, useState } from 'react';
3
+ import { useThemeContext } from './context';
3
4
  import MoonIcon from './icons/moon.png';
4
5
  import SunIcon from './icons/sun.png';
5
6
 
6
7
  export default () => {
7
8
  const [toggle, setToggle] = useState<Boolean>();
9
+ const { themeConfig } = useThemeContext()!;
8
10
 
9
11
  useEffect(() => {
12
+ // If themeConfig disabled the themeSwitch, just set to light theme
13
+ if (!themeConfig.themeSwitch) {
14
+ document.body.classList.remove('dark');
15
+ return;
16
+ }
17
+
10
18
  // 初始化,获取过去曾经设定过的主题,或是系统当前的主题
11
19
  if (toggle === undefined) {
12
20
  if (localStorage.getItem('theme') === 'dark') {
@@ -27,9 +35,17 @@ export default () => {
27
35
  if (toggle) {
28
36
  document.body.classList.remove('dark');
29
37
  localStorage.setItem('theme', 'light');
38
+ window.document.documentElement.style.setProperty(
39
+ '--color-scheme',
40
+ 'light',
41
+ );
30
42
  } else {
31
43
  document.body.classList.add('dark');
32
44
  localStorage.setItem('theme', 'dark');
45
+ window.document.documentElement.style.setProperty(
46
+ '--color-scheme',
47
+ 'dark',
48
+ );
33
49
  }
34
50
  }, [toggle]);
35
51
 
@@ -2,13 +2,8 @@ import React from 'react';
2
2
  import { Helmet } from 'react-helmet';
3
3
  import { useThemeContext } from './context';
4
4
  import useLanguage from './useLanguage';
5
-
6
- function getLinkFromTitle(title: string) {
7
- return title
8
- .toLowerCase()
9
- .replace(/\s/g, '-')
10
- .replace(/[()]/g, '');
11
- }
5
+ import getLinkFromTitle from './utils/getLinkFromTitle';
6
+ import getTocTitle from './utils/getTocTitle';
12
7
 
13
8
  export default () => {
14
9
  const { location, appData, themeConfig } = useThemeContext()!;
@@ -30,29 +25,32 @@ export default () => {
30
25
  return (
31
26
  <div
32
27
  className="w-full lg:m-12 mb-12 border
33
- border-gray-100 p-8 rounded-xl z-20"
28
+ border-gray-200 dark:border-neutral-700 py-4 rounded-lg z-20"
34
29
  >
30
+ {/* @ts-ignore */}
35
31
  <Helmet>
36
32
  <title>
37
33
  {route.titles[0].title} | {themeConfig.title}
38
34
  </title>
39
35
  </Helmet>
40
- <p className="text-lg font-extrabold dark:text-white">
41
- {route.titles[0].title}
36
+ <p className="text-lg font-extrabold text-gray-800 dark:text-neutral-50 pb-2 border-b border-gray-200 dark:border-neutral-700">
37
+ <span className="px-4">{route.titles[0].title}</span>
42
38
  </p>
43
- <ul className="max-h-[calc(100vh-360px)] overflow-y-auto py-2">
39
+ <ul className="max-h-[calc(100vh-360px)] overflow-y-auto px-4">
44
40
  {titles.map((item: any) => {
45
41
  return (
46
42
  <li
47
43
  style={{ paddingLeft: `${item.level - 2}rem` }}
48
- className="mt-3 text-gray-600 cursor-pointer dark:text-gray-400
44
+ className="mt-3 text-gray-600 cursor-pointer dark:text-neutral-400
49
45
  hover:text-blue-500 transition duration-300 dark:hover:text-blue-500"
50
46
  >
51
47
  <a
52
- className={item.level > 2 ? 'text-sm' : ''}
48
+ className={`${
49
+ item.level > 2 ? 'text-sm' : 'text-base'
50
+ } break-all 2xl:break-words`}
53
51
  href={'#' + getLinkFromTitle(item.title)}
54
52
  >
55
- {item.title}
53
+ {getTocTitle(item.title)}
56
54
  </a>
57
55
  </li>
58
56
  );
@@ -6,6 +6,7 @@ function Announcement() {
6
6
  const { themeConfig } = useThemeContext()!;
7
7
 
8
8
  if (!themeConfig.announcement) {
9
+ document.documentElement.style.setProperty('--anchor-offset', '0px');
9
10
  return null;
10
11
  }
11
12
 
@@ -8,7 +8,7 @@ function Features(
8
8
  props: PropsWithChildren<{ title?: string; subtitle?: string }>,
9
9
  ) {
10
10
  return (
11
- <div className="w-screen py-36 features dark:features-dark min-h-screen">
11
+ <div className="w-full py-36 features dark:features-dark min-h-screen">
12
12
  {(props.title || props.subtitle) && (
13
13
  <div className="mb-24 px-4">
14
14
  {props.title && (