summaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/index.ts b/src/index.ts
index 4e20848..86ef18a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,19 +1,8 @@
import type {AstroIntegration, ContentEntryType, HookParameters} from "astro"
import {fileURLToPath} from "url"
-import gemtextVitePlugin from "./vitePlugin.js"
import {parse as parseYaml} from "yaml"
-/** Gemtext configuration options */
-export interface GemtextConfig {
- /** Absolute import path to the layout to use for all gemtext pages.
- * If not provided, HMR and the Astro toolbar will not work. (default: none) */
- layout?: string
- /** The format to use for the page title. Can be one of:
- * - `first-heading`: The first heading in the document will be used as the title. (default)
- * - `filename`: The filename of the document will be used as the title.
- */
- titleFormat?: "first-heading" | "filename"
-}
+export interface GemtextConfig {}
type SetupHookParams = HookParameters<"astro:config:setup"> & {
// `addPageExtension` and `contentEntryType` are not a public APIs
@@ -23,9 +12,6 @@ type SetupHookParams = HookParameters<"astro:config:setup"> & {
}
export default function gemtext(config: GemtextConfig = {}): AstroIntegration {
- if (!config.titleFormat) {
- config.titleFormat = "first-heading"
- }
return {
name: "astro-gemtext",
hooks: {
@@ -35,10 +21,10 @@ export default function gemtext(config: GemtextConfig = {}): AstroIntegration {
params.addContentEntryType({
extensions: [".gmi"],
getRenderFunction: async (config) => {
- return async (entry) => ({
- html: entry.body ?? '',
- frontmatter: entry.data,
- });
+ return async (entry) => ({
+ html: entry.body ?? "",
+ frontmatter: entry.data,
+ })
},
getEntryInfo: async ({fileUrl, contents}) => {
const lines = contents.split("\n")
@@ -81,11 +67,6 @@ export default function gemtext(config: GemtextConfig = {}): AstroIntegration {
}
},
})
- params.updateConfig({
- vite: {
- plugins: [gemtextVitePlugin(config)],
- },
- })
},
},
}