Convert hashtags to tag option - exists, but doesn't seem to work, and isn't documented

Bear does this wonderfully. Best I have seen.

Bear does… what?

I’m not seeing an issue here with importing a file or even adding hashtags to a Markdown document and having them detected automatically.

However, @cgrunenberg would have to comment on…

  1. I don’t believe the Tags should be detected in MultiMarkdown metadata, e.g., the second line…
  2. The detected tags are now preserving the # and previously didn’t. I don’t think they should.

I see what’s happening now

  1. Tags with special characters in them (#make_doc) are not recognized. E.g., #makedoc is recognized. I don’t think the parser should care as long as there are no spaces in the tag.
  2. Tags with caps in them (#Outlook) are created as all lowercase (i.e., #outlook). The parser should not change case. E.g., #Jim_Neumann should not become #jim_neumann.

This too.

It detects the tags and updates the menu (very quickly). All tags are links to view all files under it.

To create nested tags, you just type the tag name / tag name.

[EDITED: deleted last image]

The next release will fix this, support underscores and won’t change the case (only if tagging is not case insensitive of course, see File > Database Properties)

@cgrunenberg is there any reason for convert hashtags to tags not showing up as an option in smart rule creation nor being available as a script in the Devonthink script folder? AFAIK the only way to activate it is importing a file to Devonthink or clicking in a specific menu option.

Also, would it be possible for it to interpret / in order to create nested tags? E.g. Parent Tag/Child Tag.

The usual reason - too many requests, not enough time :slight_smile: It’s at least planned for future releases.

BTW: There’s a smart rule script “Assign Tags” which shows how to use the "extract keywords from … " AppleScript command

2 Likes

I totally agree we need this option.
Because DT don’t want to implement a real time md editor I bought a third party tool but for my use case this is almost useless when my tags are not getting updated. So either implement a real time editor or support features for using a third party app please. :pray:
Can I wait for this or do I need to find another solution?

Check this box and the tags will get updated.

It works fine now (as long as you’ve ticked the box as suggested by Bernado.

Presumably you’re indexing the folder so you can use the external program? It’s what I do with Emacs.

It now doesn’t matter whether you created the indexed document externally or within DT3: as soon as it’s indexed (almost immediately), the #hashtag will be converted to a DT3 (and finder) tag.

If you’re in DT3 in an existing document and you add or edit a #hashtag, and press cmd-s, the changes will appear in DT3’s tag bar. (NB you can’t do it the other way wrong – changes to the DT3 tag aren’t reflected in hashtags.)

I think it’s really well implemented.

HTH.

1 Like

I have already checked this box. I’m not using indexed folders but just double-click the document for editing in external application. When I save the document in the external application DT “recognizes” the changes immediately but the tags are not getting updated. They just getting updated if I (additionally) save the document within DT again.

If that happens, I just use Data > Tags > Convert Hashtags to Tags.

This of course is working but that should not be the process.
I have to be sure that my documents are synchronized and up to date. You never can be sure if you have to handle it manual in two places.

I just do it manually. Sounds like it could be a good candidate for a hourly smart rule.

Christian in a post above mentions adapting the Tags Assign smart rule script - could you try that?

It would be nice if import or re-index of edited md file took care of the tag conversion – so easy to forget to do the ‘convert hashtags to tags’ command.

Indeed, you are correct. I hadn’t notice this behaviour before.

Hmm, actually I am not good in apple script and don’t want another workaround that I need to develop and maintain myself on two devices.

Just for testing I created a simple rule “after save” for “markdown suffix” that should play a sound …but nothing happens - I’m not optimistic it’ll work with more complex stuff like that without lots of efforts.

Anyway, isn’t this an inconsistence behavior in DT that needs to be fixed ?

I have no issue with this smart rule…

Jim

I’ve tried using the Assign Tags script which Christian mentions upthread – the idea being to use it within an hourly smart rule to tidy up any externally changed #hashtags as discussed in this thread.

It works – to a fashion. However, it also pulls in any word which happens to match an existing tag anywhere in the database.

E.g. create a new file with the title New Markdown and in the text write #test1 and #test2. The script picks up #test1 and #test2 and makes tags out of it, but it also picks up the word Markdown in the title and adds that as as a tag (because I already have a tag called ‘markdown’).

I’ve tried removing the ‘with existing tags’ from the relevant line leaving

set theTags to extract keywords from record theRecord with hash tags

but then it doesn’t pick up anything at all.

The original script is:

property pMaxTags : 5

on performSmartRule(theRecords)
	tell application id "DNtp"
	 repeat with theRecord in theRecords
	  set theTags to extract keywords from record theRecord with existing tags and hash tags
			
	  set n to count of theTags
		if n > 0 then
			if n > pMaxTags then set n to pMaxTags
			set tags of theRecord to (parents of theRecord) & (items 1 thru n of theTags)
		end if
	end repeat
	end tell
end performSmartRule

How do I amend it to work the same way as the Data > Tags > Convert Hashtags to Tags menu command?

Many thanks!