UTI of a CommonMark document

Does it make sense to have our own UTI (Universal Type Identifier), or maybe there is one?

For example, the standard for a Markdown document is “net.daringfireball.markdown”. Does it makes sense to use “org.commonmark.markdown” (which might indicate that this is a fully compliant CommonMark document), or is it better to just use the current standard.

Not trying to muddy the waters or detract form the current “net.daringfireball.markdown” namespace.

Where is this even used?

UTI’s are used in macOS. It’s another way of identifying the type of data in a file, beyond file extension.

From Apple’s documentation

One of the challenges facing application developers is the proliferation of methods to identify types of data. For example, some text files may be assigned a ‘TEXT’ file type (as originally designed for Mac OS 9 and earlier), while others may simply have a .txt filename extension. Some may have the .text extension instead. In addition, some file types might be subsets of other types; an application that opens all .txt files should probably also be able to open those with a .html extension. Determining all the possible files an application could read could become impossible. The user experience then suffers, with users not understanding why an application can open one text file but not another.

To solve this problem, Apple has defined a syntax for special data identifiers called uniform type identifiers. Each UTI provides a unique identifier for a particular file type, data type, directory or bundle type, and so on. In addition, other type identifier namespaces for a particular type can be grouped under one UTI, with utility functions available to translate from one format to another.

And I am certainly no expert on them or how to define them. But it’s very common to see markdown files created with the net.daringfireball.markdown UTI. So I thought that it if someone is creating a CommonMark compliant file, it might make sense to set it’s UTI to something like org.commonmark.markdown, and have it inherit from net.daringfireball.markdown

Apple has used Commonmark for swift: https://github.com/apple/swift-cmark so there is some prior art…

Yeah…but I can’t find where they are creating markdown files. Maybe they are using their version of cmark for markdown parsing inside Xcode, but Xcode doesn’t create markdown files (afaik).

Just as an example, create a .c file in Xcode, and it has a UTI of public.c-source, create a playground and it’s com.apple.dt.playground

1 Like