summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-03-24 21:32:20 +0000
committerJoe Carstairs <me@joeac.net>2026-03-24 21:32:20 +0000
commit2048c576e98acb0f1e3e26b7c75d2bc86d05ee1b (patch)
tree4c501a5ec1bfffc630b46160ca8e868703cbb460 /src
parent73bd05f6507fa6bab3a1d452dbf264f7c7bc5cf7 (diff)
trim title off body if detected
Diffstat (limited to 'src')
-rw-r--r--src/index.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/index.ts b/src/index.ts
index 85e57db..48c140a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -50,7 +50,7 @@ export default function gemtext(config: GemtextConfig = {}): AstroIntegration {
}
}
- const body = lines.slice(bodyStartLineIndex).join("\n")
+ let body = lines.slice(bodyStartLineIndex).join("\n")
const filepath = fileURLToPath(fileUrl)
const filename = filepath.slice(filepath.lastIndexOf("/") + 1)
@@ -82,6 +82,11 @@ export default function gemtext(config: GemtextConfig = {}): AstroIntegration {
?.slice(14),
)
+ if (data["title"]) {
+ body.replace(`# ${data["title"]}\n`, '');
+ body = body.trim();
+ }
+
return {
data,
rawData: frontmatter,