部署文件和插件问题修复
This commit is contained in:
@ -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";
|
||||
|
34
src/theme/Heading/index.tsx
Normal file
34
src/theme/Heading/index.tsx
Normal 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>
|
||||
</>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user