public
Last active

Double file extensions

  • Download Gist
readme.md
Markdown

.rst

The official file extension for reStructuredText files is .txt, but this is a stupid standard that should be ignored.

2.4 What's the standard filename extension for a reStructuredText file?
It's ".txt". Some people would like to use ".rest" or ".rst" or ".restx", but why bother? ReStructuredText source files are meant to be readable as plaintext, and most operating systems already associate ".txt" with text files. Using a specialized filename extension would require that users alter their OS settings, which is something that many users will not be willing or able to do.

.rst.txt

This is openable by normal text editors, but also indicates that it's formatted using reStructuredText, so it can be rendered nicely by things like GitHub. It's better than both .txt and .rst alone.

.md

*.md are recognized by GitHub and rendered nicely, but not generally understood by plain text editors. There are a million other proposed extensions for markdown files, which alone is a problem:

  • .markdown
  • .mdown
  • .mkdn
  • .md
  • .mkd
  • .mdwn
  • .mdtxt
  • .mdtext
  • .text

The official extension is .text, but this is stupid, because it's already used for other incompatible formats and doesn't in any way indicate "markdown" for the benefit of renderers or syntax highlighting.

.md.txt

This is better than .md, .txt, or .text alone. Still openable by normal text editors, but also indicates that it's formatted using Markdown, without any other metadata in the file itself, so it could be rendered nicely by things like GitHub (but currently isn't).

Additionally, embedded documents with file names ending in .md.txt will also be displayed using markdown without needing the @pagedown preamble.

Tip: Using markdown with .md.txt and .txt files instead of .wiki ones has the advantage that browsers not supporting Javascript will still render the embedded document page in a readable way (a preformatted version of the raw text). Also, the .txt extension has a meaning outside of Fossil.

Tip: Since .md.txt files don't need the @pagedown preamble, they are pure markdown documents which can be converted straight away into other formats using other markdown tools.

https://elvil.net/fossil/fossil-pagedown/doc/pagedown/README.md.txt

# Convert the specified HTML files into Markdown text-format equivalents
# in the current working directory. The file extension will be .md.txt.

http://whathesaid.ca/2008/02/11/how-to-convert-a-websites-content-into-simple-text-files/

Specifically, the shell script looks for files in my Dropbox PlainText folder with the extension “.md.txt”. This indicates it’s a text file in Markdown format.

http://netninja.com/2010/10/18/markdown-plaintext-dropbox-and-shell-scripts/

So I'm not the only one who's thought of this at least.

test.md
Markdown

Test test

Recognized by GitHub

test.md.txt
1 2 3 4
Test test
=========
 
Not recognized by GitHub
test.rst
reStructuredText

Test test

These are understood by GitHub.

test.rst.txt

Test test

Hey these are already recognized by GitHub!

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.