What is MIME type "text/asciidoc"?

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

text/asciidoc identifies files written in the AsciiDoc markup language. This format lets you create rich, structured documents using plain, human-readable text. It is designed for technical documentation and note-taking, and it converts easily into formats like HTML or PDF.

Files using this MIME type often come with extensions such as TXT, ADOC, and ASCIIDOC. These links provide more detail on the file types themselves.

For further reading on AsciiDoc and its processing tools, visit AsciiDoc.org.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: text/asciidoc    
  

HTML

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


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

Associated file extensions

FAQs

Is text/asciidoc an official IANA standard MIME type?

Currently, text/asciidoc is not technically registered in the IANA media type registry, but it is the widely accepted de facto standard used by the community and tools like Asciidoctor. Occasionally, you may see text/x-asciidoc used for compatibility, but text/asciidoc is preferred for modern applications.

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

To serve AsciiDoc files with the correct MIME type, add the AddType directive to your .htaccess or main configuration file. Use the line AddType text/asciidoc .adoc .asciidoc to ensure the server sends the correct headers to the client.

Can web browsers render text/asciidoc files natively?

No, most modern browsers like Chrome, Firefox, and Safari will display the file as raw plain text or prompt to download it. To view the content as a formatted document directly in the browser, you must install a browser extension such as Asciidoctor.js Preview.

What file extensions are commonly associated with this MIME type?

The primary extension is .adoc. However, users also utilize .asciidoc and sometimes generic text extensions like txt. Regardless of the extension, the server should identify the content as text/asciidoc to trigger the correct behavior in viewing tools.

How does text/asciidoc differ from text/markdown?

While both are lightweight markup languages, AsciiDoc is designed for more complex publishing needs, such as technical manuals and books, offering native support for includes and complex tables. text/markdown is generally simpler and more widely supported for basic web content and comments.

Why is Nginx downloading my AsciiDoc file instead of displaying it?

This usually occurs if Nginx is configured to serve unknown file types as application/octet-stream. To fix this, open your mime.types file and add the entry text/asciidoc adoc asciidoc;, then reload the Nginx service.

Is it safe to open files sent with the text/asciidoc MIME type?

Yes, AsciiDoc files are fundamentally plain text, making them safe to open in any text editor like Notepad or Vim. However, exercise caution when running untrusted files through an automated build processor, as malicious directives could theoretically exploit the rendering software.

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.