# Anyone came up with a smart way to automate removing the image title in Devonthink paste image MD link?

**URL:** <https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599>\
**Category:** DEVONthink\
**Created:** [September 2, 2022, 6:44am UTC](https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599 "2022-09-02T06:44:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeltak](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/z/a88e4f/32.png) [@zeltak](https://discourse.devontechnologies.com/u/zeltak)\
**Post date:** [September 2, 2022, 6:44am UTC](https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599/1 "2022-09-02T06:44:14Z")

</div>

hi all

I think there is no way to customize the markdown link in the `import images to group` options so that when you paste an image you always get the image name in the link, ie

`![CleanShot 2022-09-02 at 09.40.06](assets/CleanShot%202022-09-02%20at%2009.40.06.png)`

this is ugly when rendered, as I dont want to see the `Cleanshot..` name but just the image. so I want this

`![](assets/CleanShot%202022-09-02%20at%2009.40.06.png)`

anyone has any automated solution to this (or is this going to be an option in the near future?)

thx!

Z

---

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [September 2, 2022, 6:52am UTC](https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599/2 "2022-09-02T06:52:24Z")

</div>

That can be easily scripted by changing the `plainText` property of the file accordingly. In JavaScript, you’d used  
`record.plainText = record.plainText.replaceAll(/!\[.*?\]/g,"![]");`

But I’m wondering what exactly you’re _seeing_ with this kind of image link. According to the [MMD specification](https://fletcher.github.io/MultiMarkdown-4/images.html), the text should be used in the `alt` attribute of the `img` element. And that’s not something that should appear “ugly” but only visible at all if the image is not found.

---

<div class="post-metadata">

**Author:** ![zeltak](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/z/a88e4f/32.png) [@zeltak](https://discourse.devontechnologies.com/u/zeltak)\
**Post date:** [September 2, 2022, 8:32am UTC](https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599/3 "2022-09-02T08:32:30Z")

</div>

thx @chrillek !

here is what I mean visually

 ![CleanShot 2022-09-02 at 11.29.20](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/6/4/64b8eae114a6edfba4fca1ee6c573e1a545eb2c7.jpeg)

as you can see if there is a file name (in the `[]` section of the link) then naturally Devonthink presents the image name below the image. I want too just see the image. does that make sense?

thx for the `JS` snippet. where would I use it though? do I create a smart rule in Devonthink to auto launch the JS code each time a link is pasted? do I use Keyboard Maestro ?

thx!!

Z

---

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [September 2, 2022, 8:50am UTC](https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599/4 "2022-09-02T08:50:39Z")

</div>

Now I see – you’re using images outside of paragraphs. Those are converted to `figure` elements, and the string in brackets is put into the `figcaption` element. That’s actually as per the MMD specification: [MultiMarkdown User's Guide](https://fletcher.github.io/MultiMarkdown-6/MMD_Users_Guide.html#images)

And it makes, I’m sorry, perfect sense from the standpoint of semantics, accessibility and usability of the resulting HTML (and that’s what we’re talking about). The caption should convey what the figure is about (as should the `alt` attribute in the case of an `img` element). So, having an _empty_ `figcaption` goes against the semantics, and having an empty `alt` attribute goes against the accessibility of the HTML document.

If you still insist

- check the manual on how to write an internal JavaScript script for execution in a smart rule
- or search for `onperformsmartrule` in the forum to see numerous examples
- or visit \<marketing\>[Scripting with JXA | JavaScript for Automation (JXA)](https://bru6.de/jxa) \</marketing\> for more information on JavaScript on macOS (not only in the context of DT)

As to how to run the code: since there’s no “on pasting link” event in the smart rule triggers, using a KM macro might be an alternative (outside a smart rule, of course). Or, perhaps, following the HTML rules and providing _meaningful_ text there.

---

<div class="post-metadata">

**Author:** ![BLUEFROG](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/bluefrog/32/135_2.png) [@BLUEFROG](https://discourse.devontechnologies.com/u/BLUEFROG)\
**Post date:** [September 2, 2022, 1:54pm UTC](https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599/5 "2022-09-02T13:54:05Z")

</div>

[Remove Image Captions.workflow.zip](https://discourse.devontechnologies.com/uploads/short-url/9d65iuCPSnOme8jTTIeeLhVPDKm.zip) (8.0 KB)

Unzip this and double-click the resulting file.  
Select a Markdown file, then choose **DEVONthink 3 \> Services \> Remove Image Captions**.

How’s that work for you?

---

<div class="post-metadata">

**Author:** ![zeltak](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/z/a88e4f/32.png) [@zeltak](https://discourse.devontechnologies.com/u/zeltak)\
**Post date:** [September 3, 2022, 7:34am UTC](https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599/6 "2022-09-03T07:34:01Z")

</div>

thx @BLUEFROG !!

that worked nicely. I wonder if its possible to add a feature request to haver an option to do this automatically when creating the link? (ie allow an empty name when I paste the image and the link is created)

thx again

Z

---

<div class="post-metadata">

**Author:** ![BLUEFROG](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/bluefrog/32/135_2.png) [@BLUEFROG](https://discourse.devontechnologies.com/u/BLUEFROG)\
**Post date:** [September 3, 2022, 11:09am UTC](https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599/7 "2022-09-03T11:09:07Z")

</div>

You’re welcome.  
Development would have to assess this request.

---

<div class="post-metadata">

**Author:** ![system](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/2X/4/4e6ff70c96be2eb307a274d890bba8d71ba671b3.png) [@system](https://discourse.devontechnologies.com/u/system)\
**Post date:** [September 2, 2025, 11:09am UTC](https://discourse.devontechnologies.com/t/anyone-came-up-with-a-smart-way-to-automate-removing-the-image-title-in-devonthink-paste-image-md-link/72599/8 "2025-09-02T11:09:11Z")

</div>

Closed on September 2, 2025, 11:09am UTC

This topic was automatically closed 1095 days after the last reply. New replies are no longer allowed.
