Convert txt to md


has somebody, by any chance, a quick way to convert txt files (and their replicants!) to md files? Maybe via a Script?

Thanks a lot!

Make a text file. Select the name (click, short pause, then click again). Add “.markdown” (dot but no quotes) to the end. It’s now a Markdown document.

I like my own Path Finder-style renaming script that I’ve assigned to command-shift-R so that I can select a document or group and pop open a dialog to easily change the name.

v1 original; worked with content records and not groups
v2 modified to work with groups; added error handling 20131021

tell application id "DNtp"
		if selection is {} then error "Please select an item to rename"
		set numberSelected to count selection
		-- comment the following line to eliminate the "select a single item" error
		if numberSelected is greater than 1 then error "Please select a single item to rename"
		set theRecord to the first item of (the selection as list)
		set theName to the name of theRecord
		set newName to text returned of (display dialog "" default answer theName with title "Edit Name")
		if newName is not equal to "" then
			if newName is not equal to theName then
				set the name of theRecord to newName
			end if
		end if
	on error errorMessage
		display dialog errorMessage
	end try
end tell

Sorry, should have been more specific. Of course I meant to convert my txt files within DEVONthink. I have lots of txt files with replicants all over my database. If I want to convert some of them, I’d have to manually export the file from DT to Finder, rename the file-extension, import the file back in, create all the replicants of the file and then delete the original file and its replicants.

I was hoping there was an easier way, like the conversion from txt to rtf files. There I only have to right-click the txt file, convert them to rtf and delete the original and its replicants.

I’m sure it’s possible to create a Script for something like that…

You might have misunderstood – all of my comments apply to working inside DEVONthink. Not to working inside Finder. There’s no current DEVONthink command to convert Plain Text to Markdown, so if you don’t want to use the suggested workarounds inside DEVONthink you’ll want to look into writing your own script.

Appending the .md extension to the title (or replacing the existing extension) should actually be sufficient. It’s not necessary to use the Finder.

Sorry, your’re right, I misunderstood. Didn’t know this was possible. Thanks a lot!

Just tried. And it solves all my problems. Thanks!