Re: Problems imbedding images without format suffix
Posted by
mojavelinux on
URL: https://discuss.asciidoctor.org/Problems-imbedding-images-without-format-suffix-tp8342p8344.html
> There's no apparent reason the asciidoctor component (or external ruby
gem?) fetching the image couldn't name it properly or otherwise
recognize the format
This was never a goal of the Asciidoctor processor. If someone wants to propose that change, I'd be open to reviewing it.
-Dan
Jon,
If the target does not end in a file extension, then the processor cannot infer the format. In that case, you can define the format explicitly using the format attribute:
Specifying the format is only necessary if the converter needs to know it. SVG is one of those cases.
Best Regards,
-Dan
p.s. I did not realize that GitHub had an API to render LaTeX math. We could make use of that to render LaTeX math on GitHub.
On Thu, Nov 12, 2020 at 6:28 AM oddhack [via Asciidoctor :: Discussion] <
[hidden email]> wrote:
I'm trying to do math in a document by imbedding an image generated by a remote service, such as
image:https://render.githubusercontent.com/render/math?math=\displaystyle \text{b} = V D[]
In the HTML5 renderer, this works. In asciidoctor-pdf (using -a allow-uri-read, of course), I get a message like this:
> asciidoctor: WARNING: could not embed image: /tmp/image-20201112-19102-165jx60; image file is an unrecognised format
Capturing the returned image, it's just normal SVG. If I take that returned image and name it e.g. 'foo.svg' and feed that into asciidoctor as an image (HTML5 or PDF), it works fine. But if I name it in the same fashion as the WARNING, e.g. 'image-20201112-19102-165jx60', and feed that into asciidoctor as an image, I get the exact same WARNING from asciidoctor-pdf - and, although there is no warning or error message, the HTML5 renderer generates a broken-image link.
I infer that asciidoctor usually, though not always, requires an image format suffix on the source argument of image: to determine how to process it. There do not appear to be any options for the image: directive that allow specifying the format explicitly. There's no apparent reason the asciidoctor component (or external ruby gem?) fetching the image couldn't name it properly or otherwise recognize the format; the HTTP headers returned from the render server label it 'Content-Type: image/svg+xml' so that information is available, just apparently not being used.
Any thoughts on how to proceed?
Jon
--
--