Skip to content

Add support for specified image sizes in markdown documents

M  B  requested to merge brenneis/okular:feature/markdown-image-sizes into master

The discount markdown parser supports parsing explicit image sizes in markdown (e.g. ![potato](potato.jpg =100x100)), but we ignore them and use the actual image dimensions instead. With this patch, any specified image sizes are respected, including specifying only width or height (which scales the image proportionally). The scaling behavior for images where no explicit size is given has not been changed.

Screenshot with the committed test document opened (left: with patch; right: without patch):

testcase

This is the first time I contribute C++ code. I wanted to add a more sophisticated unit test by checking the output of QTextDocument *Converter::convert directly. But I got a linker error when including the converter (undefined reference to `Markdown::Converter::Converter()'). I guess that I have to add a dependency to the CMakeLists. If someone can point me into the right direction, I can extend the test case.

Merge request reports