diff --git a/src/custom/TOCChapter/TOCChapter.tsx b/src/custom/TOCChapter/TOCChapter.tsx index 35e78e96..125a7380 100644 --- a/src/custom/TOCChapter/TOCChapter.tsx +++ b/src/custom/TOCChapter/TOCChapter.tsx @@ -9,10 +9,11 @@ interface TOCProps { const TOC: React.FC = ({ availableChapters, currentChapter, onClick }) => { const reformatTOC = (data: string): string => { - let newData = data.split('-').join(' '); - const firstLetter = newData.charAt(0).toUpperCase(); - newData = `${firstLetter}${newData.slice(1)}`; - return newData; + const words = data.split('-'); + const formattedString = words + .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) + .join(' '); + return formattedString; }; return (