]> _ Git - cubist_util.git/commitdiff
wip #7894 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 14 Jan 2026 18:28:16 +0000 (19:28 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 14 Jan 2026 18:28:16 +0000 (19:28 +0100)
src/CommandLine/Docling.php

index b47b00055c4bc96f04577624c9f315bedccbda65..c64274976644bdc395f75354e9c3462923830ae1 100644 (file)
@@ -4,6 +4,7 @@ namespace Cubist\Util\CommandLine;
 
 use Cubist\Util\CommandLine;
 use Cubist\Util\Files\Files;
+use Cubist\Util\Markdown;
 
 class Docling extends CommandLine
 {
@@ -26,11 +27,16 @@ class Docling extends CommandLine
             if ($locale) {
                 $cli->setArg('ocr-lang', $locale);
             }
+            $cli->setArg('ocr-engine', 'easyocr');
             $cli->setArg('output', $tmp);
             $cli->setArg(null, $image);
             $cli->execute();
 
-            $md = $tmp . '/' . $f->getBasename('.md');
+            $md = file_get_contents($tmp . '/' . $f->getBasename('.' . $f->getExtension()) . '.md');
+
+            $html = Markdown::toHTML($md, false);
+            file_put_contents($out, $html);
+            return $html;
         }
         return file_get_contents($out);
     }