Markdown soo much better now, but still issues

Playing with the new DT3 and I’m loving it so far!

The overall design and layout is so much cleaner! And the Markdown Splitview is a great addition for example.

Plus I really like the global default style sheet for Markdown. Will make my life soooo much easier!

However there are still issues with stylesheet modifications:

  1. When editing a style sheet the chanegs are not always refelcetd in the dociment linking to the stylesheet. Sometimes only restarting DT3 sorts this. Same issue as in DT2.

  2. When exchanging the style sheet in a document for another one it seems the new one is applied “on top of the old one”: For example I had a style sheet with a font-style: italic; declaration for headers; Then I swaped it for a style sheet without the font-style, but with a color declaration. The result were headers in italic and in the new color. This looks like a new issue.

Both issues are probably WebKit caching issues. Does a restart fix the second issue too?

No, second issue perssists even after closing DEVONthink 3 and starting it up again.

The whole thing is quite a pain when you want to change CSS styles…

Tagging on to this thread about Markdown, but not specifically stylesheets…

Would it be possible to map the Cmd-I and Cmd-B buttons so that they invoke the relevant markdown syntax? At the moment they’re ghosted, but it would be great if they could still be used.

For bonus points, let us add a clipboard link (such as a URL) to a selected set of text with either a Cmd-V or Cmd-K and have it paste as a markdown URL link.

The Formatting menu commands only apply to rich text content. Development would have to assess this.

Just for fun, here’s a simple script that looks for a link on the clipboard, detects selected text in a Markdown file, and sets the clipboard to a Markdown formatted link. Since the text is already selected, you can just Command-V to replace the text with the link… and is it possible to script pressing the command key? Yes, but UI scripting is fiddly and fragile and should be avoided whenever possible. The loss of .25 seconds of pressing a hotkey is not worth it IMO.

tell application id "DNtp"
	if (get (the clipboard) begins with "http") then
		set clipLink to (get (the clipboard))
		repeat with thisRecord in (selection as list)
			if (type of thisRecord as string) = "markdown" then
				if not (exists content record) then -- If this is false, no preview is shown
					display alert "No preview is shown for this file"
					set src to selected text of think window 1
					if src = "" then -- No text is selected
						display alert "No text is selected"
						set newLink to ("[" & src & "](" & clipLink & ")" as string)
						set the clipboard to newLink
					end if
				end if
			end if
		end repeat
	end if
end tell

Jim, you are definitively a Applescript wizard! :slight_smile:

1 Like

:slight_smile: Thanks. The above script is pretty simple and logical when you read it line-by-line