Set Custom Syntax

I am trying to set a custom syntax with an action. I have an action to set the syntax to Taskpaper but I would prefer it to set it to Taskpaper+. I have the custom syntax installed and can set it manually.

I tried

Let d = Draft.create();
d.languageGrammer = “Taskpaper+”;

This doesn’t work.

What should I use to set the syntax to Taskpaper+?



languageGrammar is not what you’re looking for. It is deprecated as noted in the docs: Draft | Drafts Script Reference

you need to use syntax:

let syntax = Syntax.find("custom","Taskpaper+");
draft.syntax = syntax;

Should do what you’re looking for for the current active Draft.

If you want to create a new draft as in your short example you can adapt the code above to it.

Let me know if you need assistance with it.

Perfect, thank you.

I’ll modify some other actions to remove languageGrammer as well.

Thank you again


1 Like