mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2024-11-21 23:33:31 +01:00
Quick fix for not crashing when TOC detection thinks a headline is > 6
This commit is contained in:
parent
ea67f4b244
commit
21f36a9d4e
@ -146,7 +146,7 @@ export default class DetectTOC extends ToLineItemTransformation {
|
|||||||
const rollupLastNotFound = (currentPageNumber) => {
|
const rollupLastNotFound = (currentPageNumber) => {
|
||||||
if (lastNotFound.length > 0) {
|
if (lastNotFound.length > 0) {
|
||||||
lastNotFound.forEach(notFoundTocLink => {
|
lastNotFound.forEach(notFoundTocLink => {
|
||||||
const headlineType = headlineByLevel(notFoundTocLink.level + 2);
|
const headlineType = headlineByLevel(Math.min(notFoundTocLink.level + 2, 6));
|
||||||
const heightRange = headlineTypeToHeightRange[headlineType.name];
|
const heightRange = headlineTypeToHeightRange[headlineType.name];
|
||||||
if (heightRange) {
|
if (heightRange) {
|
||||||
const [pageIndex, lineIndex] = findPageAndLineFromHeadline(parseResult.pages, notFoundTocLink, heightRange, fromPage, currentPageNumber);
|
const [pageIndex, lineIndex] = findPageAndLineFromHeadline(parseResult.pages, notFoundTocLink, heightRange, fromPage, currentPageNumber);
|
||||||
|
Loading…
Reference in New Issue
Block a user