diff options
-rw-r--r-- | pages/post/[id].tsx | 5 | ||||
-rw-r--r-- | todo.todo | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/pages/post/[id].tsx b/pages/post/[id].tsx index 4f5acf7..b68b790 100644 --- a/pages/post/[id].tsx +++ b/pages/post/[id].tsx @@ -128,7 +128,10 @@ function parseToCRecursive(headings: Array<string>): Array<chapter> { } function parseToC(file: Array<string>): Array<chapter> { - var chapterStrings = file.filter(line => line.startsWith("#")); + var fileAsStr = file.join("\n"); + fileAsStr = fileAsStr.replace(/```.*?```/gs, ""); // filter out code blocks from table of contents + var fileAsArr = fileAsStr.split("\n"); + var chapterStrings = fileAsArr.filter(line => line.startsWith("#")); return parseToCRecursive(chapterStrings); } diff --git a/todo.todo b/todo.todo deleted file mode 100644 index d8ad265..0000000 --- a/todo.todo +++ /dev/null @@ -1 +0,0 @@ -- ignore lines starting with '#' in code blocks |