Closed danyill closed 2 years ago
I forgot to reference Issue 1451 where @mojavelinux suggested a TreeProcessor
Thinking about this (and https://github.com/asciidoctor/asciidoctor/issues/1116), maybe I did it wrong. If the user specifies the height, should we just proportionately modify the width and only set that to retain responsiveness?
The width is the only attribute that the processor considers. So the width should be computed from the height and passed through.
I realised I couldn't do height scaling on an image in a table, and discovered that there were some other image handling problems (see Issue 820 and Issue 1116). For my money I would have said that at least being able to set the height rather than the width should be a feature of the core.
I thought for education I would attempt the Treeprocessor for image blocks using fastimage as per the @mojavelinux suggestion.
I took the approach (discussed in the above issues) that aspect ratio must be as per the image sizing and so this Treeprocessor respects the image aspect ratio and doesn't allow it to be changed. There is I guess other reasonable options.
I had difficulty figuring out how to iterate across table cells to deal with block images in asciidoc styled cells. There is quite possibly a better way but it wasn't obvious to me.
Hopefully this is closer to the desired code style as well.