Table of content

Hi,
just discovered that feature after reading you blog post :slight_smile:
One question: is it possible that the toc includes folders, subfolders and the documents that are located in those folders?

That’s currently not possible.

Can you provide a link to the blog post ?

See blog.devontechnologies.com/2015/ … sy-access/
and blog.devontechnologies.com/2015/ … -contents/

It would excellent if we could create a table of contents in markdown.

You can with a script

-- Create Markdown TOC

property theTOCName : "Inhaltsverzeichnis"
property useCurrentGroup : false
property useCurrentDate : false
property addEmptyLines : true --  readability

tell application id "DNtp"
	try
		set theRecords to selection of viewer window 1
		if theRecords = {} then error "Nichts ausgewählt."
		
		set theTOCSource to ""
		repeat with thisRecord in theRecords
			set theName to name of thisRecord
			set theURL to reference URL of thisRecord
			set theMarkdownLink to "[" & theName & "](" & theURL & ")"
			set theTOCSource to theTOCSource & linefeed & theMarkdownLink & space & space
			if addEmptyLines = true then set theTOCSource to theTOCSource & linefeed
		end repeat
		
		if useCurrentDate = true then set theTOCName to theTOCName & " - " & (do shell script "date \"+%Y-%m-%d% %H.%M.%S\"")
		
		if useCurrentGroup = true then
			set theGroup to current group
		else
			set theGroup to display group selector
		end if
		
		set theMarkdownTOC to create record with {name:theTOCName, type:markdown, source:theTOCSource} in theGroup
		#open window for record theMarkdownTOC
		#activate
		
	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

Thanks @pete31.

The next release will support this (similar to Tools > Summarize Highlights)

2 Likes

@cgrunenberg, that is great news!