How to determine destination of wikilinks in markdown document?

With wikilinking enabled, let us say using square bracket notation, and when writing in markdown format, DEVONthink nicely links to destination documents in both the source view and the preview view. But, suppose I want to export that file or process it with pandoc or some other markdown processor. The markdown source does not contain the link destination: it’s just “[[some text]]”. How can the destination be determined when editing, viewing or processing the markdown file outside of DEVONthink?

(Use case: I’m trying to write a set of documents that link to each other and would be turned into a section in a website. I would use either pandoc or bookdown. If necessary, I could write a filter that translates the DEVONthink double-bracket notation of wikilinks into normal markdown syntax. But, how can I get the link destinations? If they can’t be obtained from the markdown file itself, is there some AppleScript I can write to do the processing from within DEVONthink?)

Have you tried File > Export > as Website?
Just curious.

Actually, yes, but it’s grayed out when I try it on a markdown document:

I’ll have to check it out when I get back (I’m finishing a late lunch).

1 Like

I’m not seeing an issue with the export option being disabled, however, the website export isn’t converting the WikiLink, even to an item link.

Converting the Markdown file to HTML in-app maintains the link but it’s converted to a DEVONthink item link.

@cgrunenberg would have to assess these behaviors.

I just figured out why it’s grayed out: if I open a markdown document in a separate edit window in DEVONthink and then pull down the File ➜ Export menu, it’s grayed out. If instead I select the document in a group listing, then the option is available.

That seems like an unnecessary restriction in the menu. Should I file a bug report?

That seems like an unnecessary restriction in the menu. Should I file a bug report?

No.
I have confirmed the behavior here. Website export is generally done on more than one item so perhaps it’s the logical behavior, but @cgrunenberg would have to assess that as well.

It’s only converted if the destination is exported at the same time.

Thanks for your reply. Unfortunately, even in a simple test, I can’t seem to make this happen. I am sure I’m doing something wrong but I can’t figure out what. Here is what I tried:

  1. create a folder named “website”
  2. inside that folder, create a markdown file like this:
    image
  3. click on the link “a file” in DEVONthink. It creates a new file in the same folder.
  4. add some text to that new file:
    image
  5. go back up the folders in DEVONthink to the one containing “website”, select “website”, and pull down File ➜ Export ➜ as Website… from the menus
  6. open the file “testing.html” in a web browser:
    image

The “a file” part is not a link.

Unfortunately it doesn’t seem to work if the WikiLink option Names & Aliases is disabled, the next release should fix this.

1 Like

I turned on the option, tested export again, and sure enough, the HTML is now linked. Thanks!