Graphics File Type Supported By Markdown

Again, I’m asking here because of the accumulated Markdown experience - and because I consider Drafts a kind of reference implementation…

… What types of graphic should ![]() syntax support?

Obviously .PNG and .GIF and JPEG. But what else?

Today md2pptx supports these - well .PNG at least and probably JPEG.

It also converts SVG into .PNG under the covers - if you install CairoSVG.

I expect SVG is supported by Markdown and HTML.

But what about Encapsulated Postscript (EPS)? I doubt Markdown or HTML support it directly. It would imply an interpreter in every browser.

I could make md2pptx support EPS - and that would be a documented deviation from Markdown - if it were a deviation at all. I think it would be useful.

Today SVG support is done in md2pptx, as I say, by rendering to a bitmap - targeting a particular pair of dimensions. EPS support would do the same. This conversion is necessary as I don’t believe python-pptx can handle these file types explicitly.

(I’ve asked for better documentation of what graphics file types python-pptx supports.)

When it is parsed to HTML, the HTML would be an IMG tag. Unfortunately that isn’t a one size fits all answer.

1 Like

Thanks. So EPS (and maybe some other exotic types) would have to be a documented deviation. It’s probably useful enough to do that.

As md2pptx is the one converting to .PNG I suppose I could teach it to optionally write out the .PNG. That would be a useful byproduct so that a real Markdown processor (and indeed HTML) could use the result. (mdpre could switch the filetype in generated Markdown to .PNG.)

Markdown parsers couldn’t care less what you put in the markup. There may be exceptions, but there’s no validation going on, the Markdown parser pretty much just looks for ![a](b) and outputs an HTML img tag, like <img src="b" alt="a"/> for any values of a and b.

1 Like

Thank you. I might note that in my description. Along the lines of “it would be happily processed by a Markdown processor but would fail to render in a browser”.