Thanks, that works well.

Another solution I've come to is to just display jpeg's from code cells rather than from markdown cells, like this: display_jpeg(file="img.jpg", width=400).  pandoc's normal behavior then just converts the sized image to \includegraphics[width=..., height=...]{images/...}



On Wednesday, July 20, 2022 at 8:57:26 AM UTC-7 Albert Krewinkel wrote:

Richard Huntsinger <rhunt...@berkeley.edu> writes:

> Is there a way, perhaps with a lua filter, to capture the <img
> src="image.jpg" width=600> with the sizing
> information [...]

Lua filter to do this:

``` lua
function RawInline (raw)
if raw.format:match 'html' then
return pandoc.utils.blocks_to_inlines(
pandoc.read(raw.text, 'html').blocks
)
end
end
```

This tries to convert *all* inline HTML code. Modify the `if` condition
in case you want this behavior only for images:

if raw.text:match '^<img' and ...


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/bbdf0806-8476-43af-bce7-47a17343e8f4n%40googlegroups.com.