File tree 3 files changed +6
-4
lines changed
plugins/vitepress-plugin-md-h1/src
3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { basename } from "node:path";
6
6
export default function VitePluginVitePressMdH1 ( ) : Plugin & { name : string } {
7
7
return {
8
8
name : "vite-plugin-vitepress-md-h1" ,
9
- transform : ( code , id ) => {
9
+ transform : ( code : string , id : string ) => {
10
10
if ( ! id . endsWith ( ".md" ) ) return code ;
11
11
12
12
const content = readFileSync ( id , "utf-8" ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { useUnrefData } from "../configProvider";
4
4
import themeSvg from " ../assets/svg/footerTheme" ;
5
5
import copyrightSvg from " ../assets/svg/copyright" ;
6
6
import icpRecordSvg from " ../assets/svg/icpRecord" ;
7
+ // @ts-ignore
7
8
import securityRecordImg from " ../assets/img/securityRecord.png" ;
8
9
import packageJSON from " ../../package.json" ;
9
10
import { computed } from " vue" ;
Original file line number Diff line number Diff line change @@ -19,12 +19,13 @@ import { statSync } from "node:fs";
19
19
export const transformData = ( data : FileContentLoaderData ) : TkContentData => {
20
20
const siteConfig : SiteConfig = ( globalThis as any ) . VITEPRESS_CONFIG ;
21
21
const { themeConfig } = siteConfig . userConfig ;
22
+ const { frontmatter, url } = data ;
22
23
23
- if ( data . frontmatter . date ) data . frontmatter . date = formatDate ( data . frontmatter . date ) ;
24
+ if ( frontmatter . date ) frontmatter . date = formatDate ( frontmatter . date ) ;
24
25
25
26
return {
26
- url : data . url ,
27
- frontmatter : data . frontmatter ,
27
+ url : url ,
28
+ frontmatter : frontmatter ,
28
29
author : themeConfig . author ,
29
30
title : getTitle ( data ) ,
30
31
date : getDate ( data , siteConfig . srcDir ) ,
You can’t perform that action at this time.
0 commit comments