RFC: Syntax Definition Format

Request for Comment: Interested in custom syntaxes in Drafts? Please read below. Would love feedback on the format before it is finalized.

Drafts’ editor supports multiple syntax highlighting options (Like Markdown, Taskpaper, etc.). Currently, only the syntaxes that ship with Drafts are available, but later this year we plan to make a feature available to allow users to create, install and share custom syntax definitions.

This will allow creation of additional options for popular formats not currently supported in Drafts, but also customization of and variations to common formats to support special features, or work with custom themes in different ways. And, yes, custom themes will come along with syntax definitions…details forthcoming.

I have published preliminary syntax definition documentation and would love it people interested in creating custom syntaxes would look it over, ask questions, make suggestions. If there are modifications or improvements needed to the format and related functionality, it will be a lot easier to make before finalizing a format.

Read: Preliminary Syntax Definition Format Documentation

If you have specific ideas for things you’d like to do with custom syntaxes, please bring them up as well. I’m interested to be sure as many options as possible can be supported by the format.

More docs on themes and how syntaxes and themes work together to create the final appearance of text in the editor will be forthcoming as well.


The spec looks great! Looking forward to implementing Fountain syntax for Drafts.


I’ve been waiting for this. Was so happy to hear on MPU that it was imminent. So far, I have two questions:

  1. Can you tell us which text editors’ syntax definition formats were your inspiration? I figure they will be the places to steal ideas. I see hints of TextMate and Sublime Text.
  2. Can you give us a link to the JavaScript definition? I’d like to see a example of a programming language.
1 Like

This is so so great! Love the idea of being able to create an org-mode and BibTex syntax

1 Like

awesome! I like it, how do you plan to implement an “editor” for the syntax definitions? so can I create a syntax highlighting in drafts directly (with some support e.g. a button to add a pattern and so on) or will we just be able to import a new syntax highlighting?

  1. I looked at both these formats and there are some similarities, but much simplified. Drafts is a notes app, not a code editor, and I wanted to keep the syntax highlighting lightweight and performant…and also more approachable for creating simple variants which might be useful for niche cases in productivity.

  2. I updated the page with links to both JavaScript and Simple List example definition files.

1 Like

There is unlikely to be a syntax editor in the app. At least in the short term. It’s a configuration file, and is best edited in a dedicated editor.

thanks I think you’re right!

maybe somebody creates a syntax highlighting file for the configuration format of the syntax highlighting :smiley:

I’ve not studied the syntax but I have a question:

Could this be used to enforce conformance to a syntax? So, as soon as you type something wrong it highlights this wrong thing in red?

I don’t have any example, of course… :slight_smile:

… Well a simple one would be where you type something and fail to close a bracket before end of line. (REXX would be an example of that - and I’m always miscounting brackets.

(See what I did there?) :slight_smile:

“Enforce” syntax? No. Probably possible to write patterns that would highlight unbalanced brackets, yes…but not really what this is optimized for.

Hi @agiletortoise, great draft.
I am looking forward to use asciidoc(tor) in drafts.

JSON is a good choice but has two limitations:

  • (Minor) Last elements are not allowed to have a Komma
  • (Major) no comments supported (like //)

Microsoft simply ignored both in their Visual Studio Code settings , creating a really stable user experience.

If you could support one or both of that features , it really would be great


1 Like

OK. Thanks. I was just wondering. And bracket matching will be an interesting exercise. I might do it with an action anyway.