Repository navigation
Convert PDF chapters into folders #4235
|
Hi community, I’d like to know if anyone has implemented this and could help me out. |
Replies: 1 comment
|
Yes, you can use Docling to infer the heading hierarchy, then split the exported Markdown into one folder per top-level section, keeping subsections together. This approach was tested with Docling 2.126.0 and docling-core 2.96.0. In these versions, level-1 section headers export as ##, with subsections as ###, etc. The output looks like: chapters/ On a six-page test PDF, this produced six section folders and kept nested subsections inside their parent section. This assumes the detected top-level sections correspond to your chapters. Review the extracted headings first: document titles can also become top-level sections, and chapters may sit below “Part” headings. The regex is a simple starting point; it can also match ## lines inside fenced code blocks. Images remain Markdown placeholders with these default export settings. See Docling’s heading-hierarchy documentation for the inference options. |
Hi @SlayerDevelopment,
Yes, you can use Docling to infer the heading hierarchy, then split the exported Markdown into one folder per top-level section, keeping subsections together.
This approach was tested with Docling 2.126.0 and docling-core 2.96.0. In these versions, level-1 section headers export as ##, with subsections as ###, etc.