You don't need a script for this, not any more. [My Alt Text](?{URL}) The alt text can be anything, and only really matters for someone using for example a screen reader (say, if they're blind). If the URL doesn't end in .jpg, .jpeg, .gif, or .png it will be rendered as a link (with the text "My Alt Text"). In order to force the parser to make an image out of something that doesn't end with an image extension, you can use a page anchor to trick the parser: [My Alt Text](?{URL}#.png) The Markdown parser sees that it's ending in .png, so it renders as an image, and then the browser ignores everything after the # when resolving the address for the image.