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

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

text/x-asciidoc marks files that use the Asciidoc markup language. It signals that the file is plain text containing formatting instructions for documentation.

Programs and editors use this MIME type to apply the proper syntax highlighting and processing rules. Files using this format often appear with names ending in ADOC or AD, and sometimes include a TXT suffix or even bear the name ASCIIDOC.

Learn more about its capabilities at Asciidoctor.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: text/x-asciidoc    
  

HTML

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


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

Associated file extensions

FAQs

Do web browsers render text/x-asciidoc files automatically?

No, most web browsers display these files as raw plain text by default. To view them as formatted documentation (headings, bold text, lists) directly in a browser like Chrome or Firefox, you usually need to install a specific extension, such as the Asciidoctor.js Live Preview.

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

You can map the file extensions in your .htaccess file or main server config. Add the line AddType text/x-asciidoc .adoc .ad to ensure Apache sends the correct Content-Type header for files ending in .adoc.

What settings does Nginx need for AsciiDoc support?

You should update your mime.types file or the types block in your server configuration. Insert the line text/x-asciidoc adoc ad; to associate the MIME type with the standard AsciiDoc extensions.

Why does the MIME type start with 'x-'?

The x- prefix signifies that text/x-asciidoc is a non-standard or experimental subtype not formally registered with the IANA. Despite the prefix, it is the widely accepted standard identifier used by developers and tools for AsciiDoc content.

How does text/x-asciidoc differ from text/markdown?

While both are plain text formats, AsciiDoc allows for more complex document structures, such as standard tables, footnotes, and external file includes, without needing extensions. Markdown (text/markdown) is typically simpler and preferred for basic web content and comments.

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

Yes, serving these files as text/plain is a common fallback because they are human-readable text. However, using the specific text/x-asciidoc type helps editors and browser plugins automatically trigger syntax highlighting or live preview modes.

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.