这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,4 @@ store
todos.md
examples/*/*.lock
examples/*/*-lock.yaml
.store
.nextra
.store
4 changes: 2 additions & 2 deletions docs/nextra-theme-docs/flexsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export default function Search() {
if (!indexes[localeCode] && !loading) {
setLoading(true);
const data = await (
await fetch(`/.nextra/data-${localeCode}.json`)
await fetch(`/_next/static/chunks/nextra-data-${localeCode}.json`)
).json();

const index = new FlexSearch.Document({
Expand Down Expand Up @@ -243,7 +243,7 @@ export default function Search() {

indexes[localeCode] = index;
setLoading(false);
setSearch((s) => s + " "); // Trigger the effect
setSearch((s) => (s ? s + " " : s)); // Trigger the effect
}
};

Expand Down
26 changes: 13 additions & 13 deletions docs/nextra-theme-docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function useDirectoryInfo(pageMap) {
}, [pageMap, locale, defaultLocale, asPath]);
}

function Body({ meta, toc, filepathWithName, navLinks, MDXContent, postList }) {
function Body({ meta, toc, filepathWithName, navLinks, children, postList }) {
const config = useConfig();
return (
<React.Fragment>
Expand All @@ -45,15 +45,13 @@ function Body({ meta, toc, filepathWithName, navLinks, MDXContent, postList }) {
<div className="relative w-full mx-auto overflow-x-hidden">
<article className="pb-24">
<main className="z-10 max-w-screen-md min-w-0 px-6 pt-8 mx-auto">
<MDXTheme MDXContent={MDXContent} />
<MDXTheme>{children}</MDXTheme>
</main>
</article>
<FooterMain />
</div>
) : (
<div className="relative w-full overflow-x-hidden">
<MDXContent />
</div>
<div className="relative w-full overflow-x-hidden">{children}</div>
)
) : postList ? (
<div className="relative w-full overflow-x-hidden">
Expand All @@ -65,7 +63,7 @@ function Body({ meta, toc, filepathWithName, navLinks, MDXContent, postList }) {
</div>
) : meta.full ? (
<article className="relative w-full overflow-x-hidden nextra-content">
<MDXContent />
{children}
</article>
) : meta.type === "post" ? (
<div className="relative w-full mx-auto overflow-x-hidden">
Expand All @@ -83,15 +81,15 @@ function Body({ meta, toc, filepathWithName, navLinks, MDXContent, postList }) {
</div>
</div>
<main className="z-10 max-w-screen-md min-w-0 px-6 pt-8 mx-auto">
<MDXTheme MDXContent={MDXContent} />
<MDXTheme>{children}</MDXTheme>
</main>
</article>
<FooterMain />
</div>
) : (
<article className="relative flex w-full max-w-full min-w-0 px-6 pb-16 docs-container md:px-8">
<main className="z-10 max-w-screen-md min-w-0 pt-4 mx-auto nextra-content">
<MDXTheme MDXContent={MDXContent} />
<MDXTheme>{children}</MDXTheme>
<Footer config={config} filepathWithName={filepathWithName}>
{navLinks}
</Footer>
Expand All @@ -108,7 +106,7 @@ const Layout = ({
pageMap,
meta,
route: _route,
MDXContent,
children,
headings,
titleText,
}) => {
Expand Down Expand Up @@ -291,8 +289,9 @@ const Layout = ({
) : null
}
postList={postList}
MDXContent={MDXContent}
/>
>
{children}
</Body>
</div>
</ActiveAnchor>
</div>
Expand Down Expand Up @@ -346,8 +345,9 @@ const Layout = ({
isRTL={isRTL}
/>
}
MDXContent={MDXContent}
/>
>
{children}
</Body>
</div>
</ActiveAnchor>
</div>
Expand Down
9 changes: 7 additions & 2 deletions docs/nextra-theme-docs/misc/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Link from "next/link";
import React, { useEffect, useRef, useState } from "react";
import innerText from "react-innertext";
import "intersection-observer";
import { MDXProvider } from "@mdx-js/react";

import { useActiveAnchorSet } from "./active-anchor";

Expand Down Expand Up @@ -220,8 +221,12 @@ const getComponents = (args) => ({
table: Table,
});

export const MDXTheme = ({ MDXContent }) => {
export const MDXTheme = ({ children }) => {
const slugger = new Slugger();
slugger.index = 0;
return <MDXContent components={getComponents({ slugger })} />;
return (
<MDXProvider components={getComponents({ slugger })}>
{children}
</MDXProvider>
);
};
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"match-sorter": "^6.3.1",
"next": "^12.0.8",
"next-themes": "^0.0.15",
"nextra": "2.0.0-alpha.21",
"nextra": "^2.0.0-alpha.23",
"parse-git-url": "^1.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"build": {
"outputs": [
"dist/**/*",
".next/**/*",
"public/.nextra/**/*"
".next/**/*"
],
"dependsOn": [
"^build"
Expand Down
Loading