One of the features I loved about VoodooPad was the ability to create new Markdown files by selecting a word and pressing ⌘L. This macro allows me to do that and it will also open a prompt asking for text to be placed in the new file. The exact content of the file can be adjusted, of course, and I left two templates of sorts to help with that. It is set to create the file on the same group whence the word/command came from.
Thanks for the macro! For those who don’t use Keyboard Maestro here’s a script that should do the same:
tell application id "DNtp"
try
if not (exists think window 1) then error "No window opened."
try
set invalidName to false
set theName to selected text of think window 1
if theName is "" then set invalidName to true
on error
set invalidName to true
end try
if invalidName then error "No text selected."
set theContent to display name editor info "Please enter the Markdown note:"
set theMD to "# " & theName & return & return & "{{TOC}}" & return & return & theContent & return
create record with {name:theName, type:markdown, content:theMD} in the current group
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
Just save it in ~/Library/Application Scripts/com.devon-technologies.think3/Menu as “New Markdown Note___Cmd-L.scpt”.
I understand the TOC can be used in the Markdown document - assuming you are doing further editing and adding sections to it.
But what’s the point of the document itself?
I don’t understand what a file with an H1 header of the copied text, a TOC under that, and some other text would be used for.
I have a lot of text in MD in my wiki. So If I am reading or writing on DT3 and find something interesting about a concept that is worth a separate page just for it and there is a section of the text that I want to add to this new page:
I copy the text I want to add to the new page.
Select the concept and activate the script.
I paste the text and voilà: I have a new MD page with the concept as the record’s name and title (h1). Below it there will be my wiki’s menu (which goes to every page) and finally below is the text I copied.
Digging this up a little to ask: what are you using to generate the actual menu from the {{TOC}}? I know iA Writer interprets ToC but only by looking at the headings in the current file, and only when rendered. Does your workflow include a real Table of Contents pre-preview?
If I would want to implement similar behaviour but only in one DB out of multiple i have - is it possible?
My reading of the settings is that I can only globally choose between md-style wikilinks vs names+aliases. I was experimenting with ideas from @Bernardo_V for a wiki but I still want to preserve my existing [[]] links (as they also work with 3rd party md IOS tools). Can we make this alias feature work on a DB level somehow in addition to [[]] linking?
This would allow to have one DB which would leverage @Bernardo_V alias linking approach for organising reading material and a second DB which would use wiki-links for things like notes, references, zettelkasten etc.