type fixes

This commit is contained in:
Jacky Zhao 2025-03-05 16:40:10 -08:00
parent f2c426ba33
commit fa97c7161a
2 changed files with 3 additions and 2 deletions

View File

@ -67,7 +67,8 @@ export const FrontMatter: QuartzTransformerPlugin<Partial<Options>> = (userOpts)
[remarkFrontmatter, ["yaml", "toml"]],
() => {
return (_, file) => {
const { data } = matter(Buffer.from(file.value), {
const fileData = Buffer.from(file.value as Uint8Array)
const { data } = matter(fileData, {
...opts,
engines: {
yaml: (s) => yaml.load(s, { schema: yaml.JSON_SCHEMA }) as object,

View File

@ -95,7 +95,7 @@ export function createFileParser(ctx: BuildCtx, fps: FilePath[]) {
// Text -> Text transforms
for (const plugin of cfg.plugins.transformers.filter((p) => p.textTransform)) {
file.value = plugin.textTransform!(ctx, file.value.toString())
file.value = plugin.textTransform!(ctx, Buffer.from(file.value as Uint8Array))
}
// base data properties that plugins may use