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

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

MIME type: text/x-standardml is a custom type for Standard ML source code.
It tells editors, compilers, and web tools that the file holds programming text written in Standard ML.
Files marked with this type benefit from specialized handling and syntax highlighting.
The main file that uses this MIME type has the extension SML.
For more information, check the Standard ML official site.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: text/x-standardml    
  

HTML

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


    <a href="file.dat" type="text/x-standardml">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-standardml');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the text/x-standardml MIME type used for?

The MIME type text/x-standardml represents source code written in Standard ML, a general-purpose functional programming language. It is commonly associated with the .sml file extension and is used to trigger syntax highlighting in compatible text editors and web tools.

How do I configure Apache to serve .sml files with this MIME type?

You can configure your Apache server by adding the AddType directive to your .htaccess file or main configuration. Use the line: AddType text/x-standardml .sml to ensure the server sends the correct headers.

How do I add support for Standard ML in Nginx?

For Nginx, you need to update the mime.types file or add a types block inside your server configuration. Add the entry: text/x-standardml sml; and reload the Nginx service to apply the change.

Why does my browser download the .sml file instead of displaying it?

Most browsers do not natively render or execute Standard ML code. If the server sends text/x-standardml, the browser may default to downloading the file because it doesn't recognize the type as renderable text; setting the type to text/plain can force inline display.

What does the 'x-' prefix mean in text/x-standardml?

The x- prefix indicates that this is a non-standard or unregistered MIME subtype. While not officially part of the IANA registry, it is widely accepted by the development community and recognized by resources like mime-type.com for identifying SML content.

Can I use text/plain instead of text/x-standardml?

Yes, text/plain is a safe fallback if your priority is ensuring the code is readable in a web browser without downloading. However, using text/x-standardml is semantically more accurate and helps client-side tools apply the correct specific syntax highlighting.

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.