Hacker News new | comments | show | ask | jobs | submit login
Journo and Literate CoffeeScript (ashkenas.com)
65 points by jashkenas 1521 days ago | hide | past | web | 17 comments | favorite

Jeremy, your code's comments are all hard-wrapped at column 80, but the code itself extends beyond that.

Do you tell your editor to hard-wrap each "block" of comments as you write (or edit) them, or is your editor configured to automatically hard-wrap all comments?

Either way, have you considered configuring your editor to soft-wrap comments while leaving your code alone? I'd say that's the most natural approach from a writing standpoint.

P.S. Every day, I use tools you've made. Keep making!

Yeah, in an ideal world, that would be better -- and I've tried writing like that ... but sooner or later I end up wanting to open the file in a location where the wrapping isn't configured properly, and all of the super long lines look terrible.

So I just tend to hard-wrap manually, out of habit, even when writing in a .txt file or an email. In fact, it's hard to stop myself from doing it in this textarea ;)

What editor do you use? With vim I think I've always been able to select comments and "gq" them to autoformat them to whatever the linewidth is set to.

TL;DR posted up the earlier-promised example Literate CoffeeScript blog engine: https://github.com/jashkenas/journo

I've always been excited by the idea of literate programming, and after having flirted with most of the other Javascript meta-languages, now use Coffeescript as my main language for both server-side (node.js) and client-side code. Is there currently a good syntax highlighting mode that properly displays .litcoffee files? I currently use Emacs with the coffee-mode major mode, but I don't think it's been updated yet.

I'm not aware of an Emacs one being updated yet, although I think that someone's finished it for Vim.

If you want to be an open-source hero -- go ahead and do it yourself ;) It's mainly a matter of taking the Markdown package, and the CoffeeScript package, and pasting the latter into the former, right where the syntax rule for "code block" goes.

Do you have a link to the vim plugin you referenced?

But that sounds haaaaaaard.

First, I'd like to thank you for your great work, I'm one of the many to have benefitted from it.

I decided to take journo for a spin and wrote this up in hopes you'd continue to work on it.



I am a big fan of the goals of your work (CoffeeScript, Literate Programming).

Both projects make code easier to understand and more accessible to everyone.

I have the feeling that many of us forget about the value of this, after having invested many hours to understand complex syntaxes and general patterns.

From lowering the entry barrier and increasing efficiency, everybody will profit in the end.

Well that was interesting. Started reading the readme formatted on the page.. Well commented as usual, nice little snippets to demonstrate..

About half way through realized it was the actual source file.

It's always interesting how something that shouldn't be that big of a deal is a much bigger deal when experienced. I mean that using Markdown is not conceptually different than writing judiciously-placed block comments, but the ease of formatting for the coder -- and the most definite impact on reading for the reader -- is a huge impact. Thinking about it now, I sometimes skip self-documentation even when I know it's the right thing to do (given how much time we spend re-reading code compared to writing it) because it's annoying just enough to remember what my style/convention is to make long comments readable. Having Markdown provide the template removes that cognitive barrier, and hopefully makes it easier to ease into the documentation process.

Loving the litcoffee format! Clean, elegant, addictive.

Simple example usage: https://github.com/joyrexus/tester

&: https://gist.github.com/joyrexus/5147449

For vim-ers, check out vim-literate-coffeescript: https://github.com/mintplant/vim-literate-coffeescript

I've found a few additional mappings quite useful: https://gist.github.com/joyrexus/5112582

Now need to take a closer look at journo and docco integration.

I had never heard of literate programming until Monday with the release of CoffeeScript 1.5.0

So I tried it out and found it to be a really rewarding experience: https://github.com/JonAbrams/tomljs

I experimented with Literate Programming in PHP two years ago: http://bergie.iki.fi/blog/literate_programming_with_php/

I thought the `do loadManifesto' syntax was discouraged in favor of 'loadManifesto()'? I've read jashkenas say he wished that hadn't been introduced in the first place, and now I see it in his code.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact