File tree Expand file tree Collapse file tree 4 files changed +18
-0
lines changed
Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 88use Psr \Log \LoggerInterface ;
99use Roave \DocbookTool \DocbookPage ;
1010
11+ use function ini_set ;
1112use function sprintf ;
1213
1314final class MarkdownToHtml implements PageFormatter
@@ -18,6 +19,11 @@ public function __construct(private readonly LoggerInterface $logger)
1819 {
1920 $ this ->markdownParser = new MarkdownExtra ();
2021 $ this ->markdownParser ->code_class_prefix = 'lang- ' ;
22+
23+ // The PCRE backtrack_limit is increased to support bigger inline content, e.g. images
24+ // See https://github.com/michelf/php-markdown/issues/399 and https://github.com/michelf/php-markdown/issues/399
25+ // 5_000_000 is 5-times the default and should allow images up to at least 1 MB
26+ ini_set ('pcre.backtrack_limit ' , 5_000_000 );
2127 }
2228
2329 public function __invoke (DocbookPage $ page ): DocbookPage
Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ Here are some images:
6363
6464They are hand drawn, that's why they look rubbish.
6565
66+ ### A larger image
67+
68+ This is an image that's over 500kb so we can be sure that bigger images work:
69+
70+ ![ A snowy mountain] ( ./large-image.jpeg )
71+
6672## Inline PUML file
6773
6874![ An external PlantUML diagram] ( ./external-diagram.puml )
Original file line number Diff line number Diff line change @@ -85,6 +85,12 @@ <h2>Some images</h2>
8585
8686< p > They are hand drawn, that's why they look rubbish.</ p >
8787
88+ < h3 > A larger image</ h3 >
89+
90+ < p > This is an image that's over 500kb so we can be sure that bigger images work:</ p >
91+
92+ < p > < img src ="data:image/jpeg;base64,/9j/4A%s " alt ="A snowy mountain " /> </ p >
93+
8894< h2 > Inline PUML file</ h2 >
8995
9096< p > < img src ="data:image/png;base64,iVBORw%s " alt ="Diagram " /> </ p >
You can’t perform that action at this time.
0 commit comments