Looking for a workflow for notes in markdown

@mmynsted thank you very much for the in-depth reply. the applescript is probably not difficult.

the problem is that i do not like the DT “editor” and would love to use another one (ulysses for example). But with the way DT stores the data, I don’t know how to embed an image in markdown and still make it visible in another editor.

This is all macosx anyways. Considering I am also a heavy ios user, i don’t see a way of making the solution cross-platform at the moment.

For example, let’s i have the image applescript as you describe, what do i do when i have an image on ios? on ios it is even more vital to not use the horrendous DTTG “editor”.

@groovytwo

thx for your post! Any chance you can share your keyboard maestro macro?

thx

Z

Yes, no problem. Before I begin, a few caveats

  • I am positioning application windows according to specific dimensions applicable to my computer monitor.
  • This script assumes that the image repository folder is called img.

There are two scripts, the first script sets the call-back URL of the img folder. The second script imports the file. Hope this helps!

Script 1

Script 2

thx so much! Looks great. Any chance you can share the actual kmmcaro file (unless im mistaken you posted a long png?)

appreciate your help!

Z

Yeah no problem.

One other thing. To start the macro, you need to have the file selected in Finder. Leave the mouse at the position where you selected the file (so that it can drag the file into Devonthink).

https://drive.google.com/uc?export=download&id=1o7IRTLpfuuY_v9gR-XAdqNxYMHzPozK3

Has anyone done something like that? That to me would be a super useful script to share. Im also exploring various ways to quickly deal with local images in md files that would be portable

thx

Z

Why do you need a script when you can drag and drop an image into the source of the Markdown to insert a proper image link?

To get the image downloaded

thx @BLUEFROG, a bit off topic for this thread but your support is the best I’ve seen for any app I’ve ever used (FLOSS or commercial) in 25 years of using software…its really appreciated immensely and helped me stay afloat when starting to use devonthink… :smile:

…back to the point!

so yes the issue for me is downloading the image associated with the buffer link for future reference and also compatibility with other apps/portability. Ive have many experiences with my org-mode text files linking to images in websites that then went dead and thus I like to save all images localy.

after reading through the forums a lot on this topic this thread seems to be describing mostly what I had in mind but I agree with @bosie that the current situation is kinda cumbersome. for example I’ve used emacs org-mode for nearly 15 years and there is a little package there called org-download:

https://github.com/abo-abo/org-download

that solves all these issues. for example:

This extension facilitates moving images from point A to point B .

Point A ( the source ) can be:

  1. An image inside your browser that you can drag to Emacs.
  2. An image on your file system that you can drag to Emacs.

Point B ( the target ) is an Emacs org-mode buffer where the inline link will be inserted. Several customization options will determine where exactly on the file system the file will be stored.

They are: org-download-method :

  1. 'attach => use org-mode attachment machinery
  2. 'directory => construct the directory in two stages:

Back to devonthink, basically the workflow that I personally am looking for is

  1. launch a new markdown file and start editing

  2. when I need to add image (be it locally or from the web) I can just either:

  • drag an image from a browser
  • copy the image URL
  • drag /copy image from finder
  • the a screen shot via system screenshot util
  • opaste image from clipboard
  1. then this process/script will
  • insert a proper markdown link with full path to the image
  • create a group with the name of the current markdown file, create a sub directory inside that group called img or any other name
  • copy the md file into the group
  • copy the image into the imd file

does that make any sense :wink: seems complicated just describing it. unfortunately I have zero programming knowledge…(I an academic in the humanities…:). So wouldn’t even know where to start with this

Also would love to hear any alternative workflows from the community that will allow easy work with images in a self contained way that works both in DT but also be portable

ofc the holy grail would be that the capture/sorter function in devonthink could do that for you :wink:

hope this makes sense and thx again!

Z

1 Like

Why don’t you use the method I describe, using a group to contain the file and assets and using relative links, no different than web pages do?

  1. Make a group.
  2. Add a Markdown doc.
  3. Drag and drop your image into the group - or a subgroup, if you want to use such a structure (I do).
  4. Drag and drop the image into the Markdown source and the link is inserted.

In fact, now that @cgrunenberg added the drag and drop into Markdown like this, I use this method even more… every single day. (And yes, I used to type the links out, and still find that to be an acceptable way to enter them. :slight_smile: )

That group is portable and self-contained. Easy.

@BLUEFROG as said before, this seems like a terrible long-winded way of doing a one-step action. the drag and drop doesn’t work out of firefox, so now i have to do what?

  • save it to disk (why?)
  • then find it in Finder
  • navigate/open the subgroup in DT
  • drag the image into the subgroup from finder
  • Drag the image from the subgroup into the markdown (this isn’t straight forward either since the markdon document is at this point in View mode and not editable)

compare this to

  • drag from firefox into markdown doc

additionally, even when you are doing your way, it isn’t viewable by other apps, is it? those relative paths don’t work in other apps

Hi

I actually like the method @BLUEFROG suggested (but I use safari).
I tried it now and it makes a lot of sense. I even exported the whole groups via the export files and folders and opened it in Bbedit and the images rendered well!

  • save it to disk (why?)

I actually do want to save it in disk so I have it permanently there even if the website dies.

the only issue is how to automate it in terms of maybe a quick way to convert an existing .md file to a group and putting that file in it, while also creating a imd folder in that group. That would make things a bit easier when you repeat that.
perhaps an apple script could fit? Or maybe I can play with keyboard maestro but @BLUEFROG suggested in multiple occasions its better to script rather then use GUI macros ;d

thx again

Z

Why do you want to save it to disk when you add it to Devonthink? Do you keep two copies, one in devonthink and the other in Finder somewhere?

@bosie, yes I want to save it to the devonthink but also I just saw another workflow:

this one docent save in devonthink yet rather saves all image files for all .md files regardless of where they are in a central dropbox repo (images) and refer all image links to that folder\

now another dilemma comes up. Use that method of a central repo or the nice self contained within devonthink method @BLUEFROG suggested…:confused:

any thoughts guys of the cons and pros of each method?

would love to hear for the users here to finalize on a method so I can start actually collecting notes :slight_smile: :slight_smile:

best

Z

I still don’t get why you want your images in dropbox but your markdown in devonthink.

it sounds like you shouldn’t be using devonthink at all for markdowns. just save everything in dropbox and use a proper markdown app for editing/viewing the files. you can then use DT to index the external folder. That way you can have DT suggest other files with ‘see also’ etc but you also get proper markdown support.

even when you are doing your way, it isn’t viewable by other apps, is it? those relative paths don’t work in other apps

That is incorrect and easily proven.

My method is no different than creating a standard web page (which is ultimately what Markdown is rendered as).

If you use the Item Link (x-devonthink-item://), then you are correct. Those are not going to act as valid image links outside DEVONthink. But they’re also not static URLs either, so don’t use them if you’re going to work with the files outside DEVONthink. Simple.

the drag and drop doesn’t work out of firefox, so now i have to do what?

Use a better browser? :stuck_out_tongue:

Just make a template group.

  1. Make a group
  2. Put subgroups, e.g., img, styles, etc., in the group.
  3. Put in a template Markdown file. This can include internal styling or links to stylesheets, etc.
  4. Chose the group and select File > Export > as Template.

Done.
Now it’s available in Data > New > New from Template.

image

(And yes, you could do even fancier things but the question is: do you need to and have the time to explore it?)

1 Like

Wow that’s fanatics, didn’t even think of this!

is there anyway though that when I launch the template I can have the name of the group also be the name the md file (…yes as you can see im lazy…:))

that is launch template, enter the name of the group as group1 and the .md file created will be group1.md

thx

Z

That is incorrect and easily proven.

Show me how, the markdown is literally something along the lines of

![title](my_special_group/important_image.jpg)

Of course this isn’t going to be viewable in another app. But prove me wrong, please.

Firefox

No better browser than Firefox around. Besides, since drag and drop is not a problem out of Firefox except with DT, i guess it is a bug in DT

Of course this isn’t going to be viewable in another app.

It absolutely is… and I’ve been doing it for years now.

Here is my group, created per my instructions in DEVONthink, dragged to the Finder, and the Markdown opened in MultiMarkdown Composer.