What is MIME type "text/x-typst"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

text/x-typst is a MIME type for files that hold Typst code.
It signals that the file contains instructions for a modern typesetting system. This language is used to design documents with precise layouts and styles.
Files using this MIME type typically have the TYP file extension.
For more details, visit the official Typst website.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/x-typst    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/x-typst">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/x-typst');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the purpose of the text/x-typst MIME type?

The text/x-typst MIME type identifies files containing Typst source code. It tells web servers and applications that the file is a text-based script used for modern typesetting, typically associated with the /file-extension/typ extension.

How do I configure Apache to serve .typ files correctly?

You can add the MIME type definition to your .htaccess file or main configuration. Add the line AddType text/x-typst .typ to ensure Apache serves these files with the correct header.

How do I add text/x-typst support to Nginx?

Update your mime.types file or the types block in your server configuration. Add the entry text/x-typst typ; and reload Nginx to apply the changes.

Can web browsers render text/x-typst files directly?

No, web browsers do not have a built-in engine to render Typst markup as a formatted document. Browsers will either display the raw code as plain text or prompt the user to download the file. To view the final layout, the code must be compiled to PDF or SVG.

What does the 'x-' prefix indicate in this MIME type?

The x- prefix signifies that text/x-typst is a non-standard or experimental subtype that has not yet been officially registered with IANA. It is the convention used by the developer community to identify Typst files before official standardization.

Why do .typ files look like plain text when opened?

Because text/x-typst is a text-based format, it contains human-readable instructions rather than binary data. You need a dedicated editor or the Typst web app to process this syntax into a styled document.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.