Drag image into markdown document and generate HTML tag instead of markdown reference?

42 views
Skip to first unread message

Craig Heilman

unread,
May 27, 2022, 12:34:40 PM5/27/22
to 'Jeffrey Jones' via BBEdit Talk
I know that I can drag an image file into a BBEdit markdown document and BBEdit will give me a markdown reference like so (image and markdown document are in the same folder):

![<# alt text #>](diagram.png "diagram.png")

I often have to adjust the size of an image in markdown documents so I end up having to change the markdown references to HTML image tags something like this:

<img src="diagram.png" alt="my diagram" width="200" />

Is there a way to change the default BBEdit behavior to get an HTML tag instead of a markdown reference when dragging an image file into the document?

Thanks,

Craig


--
Craig Heilman
Bugaboo Software



jj

unread,
May 28, 2022, 4:37:28 PM5/28/22
to BBEdit Talk
Hi Craig,

You should check the `documentWillInsertTextForDroppedImageFile` document attachment point.

Manual page: 347/348

    on documentWillInsertTextForDroppedImageFile(theDocument, theImageFile, proposedText)
        tell application "Acorn" to open theImageFile
        return proposedText
    end documentWillInsertTextForDroppedImageFile.

HTH,

Jean Jourdain
Reply all
Reply to author
Forward
0 new messages