Files
remanso/src/utils/noteTitle.ts
2026-03-28 09:38:55 +01:00

19 lines
496 B
TypeScript

export const filenameToNoteTitle = (title: string) =>
title.replaceAll("/", " / ").replaceAll("-", " ")
export const pathToNotePathTitle = (path: string) => {
const fileNames = path.split(".")
fileNames.pop()
return fileNames
.join(".")
.split("/")
.filter((path) => !path.includes("README"))
.join("/")
.replaceAll("-", " ")
}
export const pathToNoteTitle = (notePathTitle: string) => {
return pathToNotePathTitle(notePathTitle).split("/").pop()?.trim() ?? ""
}