Toggling the "Best Alternative" display of Markdown files

By default, DT shows markdown files as plain text. One can use Quicklook to see them rendered, but links are not clickable in the preview. One can click on the “Best Alternative/Text Alternative” icon to toggle between the two, but that can get old if you are looking at lots of files.

In the forum posting [url]Put up Example page], Christian Grunenberg pointed out how to set the default for rendering Markdown to true. The only problem with doing so if that one then can’t edit the files in DevonThink without clicking on the “Best Alternative/Text Alternative” icon for each file. So, I wrote a small AppleScript, below, which toggles the default between rendering Markdown files as text or as rendered Markdown. If a markdown file is selected when you trigger the script, you may need to deselect and reselect the file to see the change.

I hope someone finds it useful.


Use of this code subject to agreement to the following terms.

* Hold Liable: Software is provided without warranty and the software author/license owner cannot be held liable for damages.

* License: Include a copy of this license with the code

Commercial Use: This software and derivatives may be used for commercial purposes.
Distribution: You may distribute this software.
Modification: This software may be modified.
Private Use: You may use and modify the software without distributing it.


property renderMarkdown : true

if renderMarkdown then
	open location "x-devonthink://preference?key=RenderMarkdown&value=no" 
	open location "x-devonthink://preference?key=RenderMarkdown&value=yes"
end if

set renderMarkdown to (not renderMarkdown)