trim title off body if detected
This commit is contained in:
+6
-1
@@ -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 filepath = fileURLToPath(fileUrl)
|
||||||
const filename = filepath.slice(filepath.lastIndexOf("/") + 1)
|
const filename = filepath.slice(filepath.lastIndexOf("/") + 1)
|
||||||
@@ -82,6 +82,11 @@ export default function gemtext(config: GemtextConfig = {}): AstroIntegration {
|
|||||||
?.slice(14),
|
?.slice(14),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (data["title"]) {
|
||||||
|
body.replace(`# ${data["title"]}\n`, '');
|
||||||
|
body = body.trim();
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
rawData: frontmatter,
|
rawData: frontmatter,
|
||||||
|
|||||||
Reference in New Issue
Block a user