mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2024-11-24 16:54:12 +01:00
#61 Make sure to prevent: Unsupported headline level: 7
This commit is contained in:
parent
4ba336f203
commit
33c2d3d3d5
@ -69,7 +69,7 @@ export default class DetectHeaders extends ToLineItemTransformation {
|
||||
heights.forEach((height, i) => {
|
||||
const headlineLevel = i + 2;
|
||||
if (headlineLevel <= 6) {
|
||||
const headlineType = headlineByLevel(2 + i);
|
||||
const headlineType = headlineByLevel(headlineLevel);
|
||||
parseResult.pages.forEach(page => {
|
||||
page.items.forEach(item => {
|
||||
if (!item.type && item.height == height && !isListItem(item.text())) {
|
||||
|
@ -244,8 +244,12 @@ function findHeadlineItems(page, headline) {
|
||||
}
|
||||
|
||||
function addHeadlineItems(page, tocLink, foundItems, headlineTypeToHeightRange) {
|
||||
const headlineLevel=tocLink.level + 2;
|
||||
if(headlineLevel>6){
|
||||
return ;
|
||||
}
|
||||
foundItems.headlineItems.forEach(item => item.annotation = REMOVED_ANNOTATION);
|
||||
const headlineType = headlineByLevel(tocLink.level + 2);
|
||||
const headlineType = headlineByLevel(headlineLevel);
|
||||
const headlineHeight = foundItems.headlineItems.reduce((max, item) => Math.max(max, item.height), 0);
|
||||
page.items.splice(foundItems.lineIndex + 1, 0, new LineItem({
|
||||
...foundItems.headlineItems[0],
|
||||
|
Loading…
Reference in New Issue
Block a user