部署文件和插件问题修复

This commit is contained in:
2024-03-22 20:31:04 +08:00
parent fab9914f39
commit c956a8dfed
20 changed files with 595 additions and 24 deletions

View File

@ -25,7 +25,7 @@ import dayjs from "dayjs";
- user doesn't ask to hide it with front matter
- the markdown content does not already contain a top-level h1 heading
*/
function useSyntheticTitle(): string | null {
export function useSyntheticTitle(): string | null {
const { metadata, frontMatter, contentTitle } = useDoc();
const shouldRender =
!frontMatter.hide_title && typeof contentTitle === "undefined";

View File

@ -0,0 +1,34 @@
import React from "react";
import Heading from "@theme-original/Heading";
import { useSyntheticTitle } from "../DocItem/Content";
import { useDoc } from "@docusaurus/theme-common/internal";
import dayjs from "dayjs";
import { Detail } from "docusaurus-plugin-content-docs-ex/src";
export default function HeadingWrapper(props) {
const syntheticTitle = useSyntheticTitle();
const doc = useDoc();
const detail = (doc.metadata as any).detail as Detail;
return (
<>
<Heading {...props}>
{props.children}
{detail && !syntheticTitle && (
<span
style={{
display: "block",
fontSize: "14px",
fontWeight: "normal",
marginBottom: "10px",
marginTop: "10px",
}}
>
{dayjs(detail.create_date).format("YYYY年MM月DD日")} · {" "}
{Math.ceil(detail.reading_time.minutes)}
</span>
)}
</Heading>
</>
);
}