FWIW, doctest.js briefly supported CoffeeScript, back when the format was essentially language-neutral:
$ makeRequest({
> url: 'http://example.com/endpoint',
> data: 'foo',
> success: Spy('makeRequest', {wait: true}),
> });
makeRequest(...)
The example and output was parsed essentially by regexes. That was kind of okay, but I'm much happier with the new comment-based format. But that depends on parsing the language itself, so it's nontrivial to add other languages (before I only had to replace eval).
Still, supporting CoffeeScript shouldn't be a big task, it would just require abstracting out some of the parsing, and having a way to select the language (probably just another CSS class on elements, and/or the page body). The only parsing doctest really cars about is chunking the text by comment.
In regards to abbreviated examples: you can write your test in one big chunk, and I like to do this when I'm really testing and not explaining – doctest.js is not intended to just be a documentation tool. But if you are composing docs, then doctest will only test things that are explicitly marked to be tested. It's not as strict as Python's doctest, because it's using essentially invisible information to determine what's a test (a CSS class). You can also have it test things that aren't visible in the docs themselves, but are necessary to create a usable environment for the tests.
Of course a lot of things, like makeRequest, are only interesting if you handle the async aspect of the code. Spy() is handy for testing, but will look peculiar in documentation. It occurs to me that for documentation you might want:
makeRequest({
url: 'http://example.com/endpoint',
data: 'foo',
success: function () {
print('I got a response:', this.status);
},
});
// (later) => I got a response: 200
Where "(later)" tells the test runner to wait for at least
something to be printed out.