News for hackers. Stuff that matters.
Re:Elegant Markdown for a more civilized age by autarch on Wednesday August 03, 2011 @03:24PM (#2842600)
Wow, what a crazy idea. Decoupling parsing from output generation. What will those crazy Ruby kids think of next?
Re:Elegant Markdown for a more civilized age by jasonlotito on Wednesday August 03, 2011 @03:43PM (#2842688)
I wonder how many people are seeing the sarcasm, and how many think you are serious. =)
Re:Elegant Markdown for a more civilized age by pavel_lishin on Wednesday August 03, 2011 @03:57PM (#2842741)
What's the markdown tag for sarcasm again?
Re:Elegant Markdown for a more civilized age by stock_toaster on Thursday August 04, 2011 @01:34AM (#2844760)
nine whitespace characters at the end of a newline
Re:Elegant Markdown for a more civilized age by asolove on Wednesday August 03, 2011 @04:10PM (#2842810)
It's especially interesting because this same idea is also responsible for saving Rails 3's ass from being far slower than Rails 2. Read through this discussion of how Rails 3 queries were sped up by using an AST decoupled from its final use: http://www.slideshare.net/tenderlove/zomg-why-is-this-code-s....
Re:Elegant Markdown for a more civilized age by stephth on Wednesday August 03, 2011 @08:33PM (#2843919)
47 comments in this thread and this is the top comment. Could someone explain what value it adds to the conversation? I'm completely missing it.
Re:Elegant Markdown for a more civilized age by stock_toaster on Thursday August 04, 2011 @01:43AM (#2844791)
The original upskirt markdown library, written by Natacha Porté[1], had a specific goal of separating the parsing of markdown and the generation of html. When github forked it, they apparently (according to Natacha's comments on her site) slowly added more and more logic which mingled and blurred the lines.

Now this article seems to be coming from a standpoint that separation of the two concerns is somehow novel. A bit odd to say the least. I think this is where the o.p. was deriving sarcasm.

Perhaps the real story is the separation of concerns in the ruby module wrapper, instead of at the c library level? I don't know.

[1]: http://fossil.instinctive.eu/libupskirt/index

Re:Elegant Markdown for a more civilized age by pyre on Thursday August 04, 2011 @01:24AM (#2844727)
It allows real computer scientists to laugh at stupid webdevs reinventing the wheel. </sarcasm>

(Except no one was claiming that it was a novel idea, just that in the past, most Markdown processors just convert directly between Markdown and HTML, but now they are changing that. It's also funny that there seems to be some animosity in that post towards Ruby programmers for whatever reason. It's not like Markdown is an invention of Ruby, the reference implementation was written in Perl.)

Re:Elegant Markdown for a more civilized age by pshangov on Thursday August 04, 2011 @02:22AM (#2844905)
Also, fore a more robust and extensible Markdown parser, see the perl's Markdent: http://search.cpan.org/dist/Markdent/
Re:Elegant Markdown for a more civilized age by joehewitt on Wednesday August 03, 2011 @05:06PM (#2843098)
I recently wrote something just like this for Node.js:

https://github.com/joehewitt/markdom

It's used on http://uponahill.com to extract Flickr urls so I can query the Flickr API and get complete metadata about each photo. My gf, who does most of the writing/photography on the site, has found writing in Markdown and copy/pasting Flickr urls a pretty frictionless experience compared to the Wordpress CMS.

Re:Elegant Markdown for a more civilized age by benatkin on Thursday August 04, 2011 @01:01AM (#2844649)
Darn...I was hoping it was pure javascript so I could run it client-side. Nicely done, though!
Re:Elegant Markdown for a more civilized age by stock_toaster on Thursday August 04, 2011 @01:46AM (#2844797)
You could try markdownjs[1].

[1]: https://github.com/evilstreak/markdown-js

Re:Elegant Markdown for a more civilized age by benatkin on Thursday August 04, 2011 @02:03AM (#2844843)
I already know about that and I like it. I wanted to see a different take on it, though!

I'm going to take another look at it soon.

Re:Elegant Markdown for a more civilized age by pavel_lishin on Wednesday August 03, 2011 @03:25PM (#2842603)
At a certain point, isn't it easier to just write the HTML?
Re:Elegant Markdown for a more civilized age by jseliger on Wednesday August 03, 2011 @03:31PM (#2842628)
Actually, this is related to a question I've thought about but never asked: if you're, say, writing a blog, why use Markdown over standard HTML? Does it give some advantage I'm not aware of?
Re:Elegant Markdown for a more civilized age by technoweenie on Wednesday August 03, 2011 @03:33PM (#2842639)
You can write content faster if you're comfortable with the syntax. It also has the advantage of looking good unstyled and styled. The syntax tends to look like a styled plaintext email.
Re:Elegant Markdown for a more civilized age by michaelschade on Wednesday August 03, 2011 @03:39PM (#2842667)
This. I use Markdown syntax when writing blog posts since Posterous formats Markdown just fine and it lets me view my writing (mostly) unstyled in vim, which I personally find much more comfortable than some web-based editor.
Re:Elegant Markdown for a more civilized age by bergie on Wednesday August 03, 2011 @04:14PM (#2842839)
I do the same, though I guess this is more the fault of current web-based editors than of HTML itself.

I'm trying to explore some ideas of simplicity in browser-based HTML editing with Hallo (http://bergie.github.com/hallo/), but remains to be seen how well that works out. In the meanwhile there is always Markdown. And Vim.

Re:Elegant Markdown for a more civilized age by 6ren on Wednesday August 03, 2011 @04:51PM (#2843016)
It's striking to me that markdown has become so popular, when wysiwyg HTML editors have been around for a long time, and are supposed to be easier to use (I would expect them to be).

Perhaps it's partly that using asterisks for emphasis makes more intuitive sense than ^I or clicking a button etc; and partly that mostly people don't use it - let alone the more complex markdown features.

Re:Elegant Markdown for a more civilized age by michaelschade on Wednesday August 03, 2011 @07:24PM (#2843667)
It's not that the WYSIWYG editors aren't easy to use in most senses–they're not difficult at all. However, many people that use Markdown are probably geeky enough to not need some WYSIWYG editor in the first place.

For me, I'm in the terminal and MacVim for a good portion of my day hacking around; so, while I enjoy portions of the Google Docs(or whatever editor) interface, if I stop my usual coding activities to write a blog post, I'd like to stay in my natural environment of vim and terminal. This is particularly true if my blog post contains code–it feels much more natural for me to paste code samples between vim windows than it does to copy code from vim and paste it into some external editor.

(So, basically, it's not just the syntax, it's also the environment in which I get to write that syntax.)

Re:Elegant Markdown for a more civilized age by macrael on Wednesday August 03, 2011 @09:45PM (#2844149)
The biggest advantage for Markdown is that it is in plain text. It looks good in plain text. This makes it incredibly portable, lets me write it in whatever text editor I have at hand (even ssh'd into another machine (though I don't do that very often, everything I write is just in dropbox)). I prefer having my writing sitting on my machine in straight forward plain text formats rather than in HTML. It is so much easier to deal with this way, and it is a one step process to convert it to HTML when I want to post it online. Plus, if I want to convert it to some other format, it would be trivial to do so.
Re:Elegant Markdown for a more civilized age by bergie on Wednesday August 03, 2011 @06:52PM (#2843559)
I think it would make a lot of sense for WYSIWYG editors to support Markdown-like microsyntax for simple formatting:

https://github.com/bergie/hallo/issues/11

This way you start writing _something, and it becomes something

Re:Elegant Markdown for a more civilized age by lysol on Wednesday August 03, 2011 @03:36PM (#2842657)
Agreed. It gracefully degrades into something readable if parsing fails, which is not applicable to HTML.
Re:Elegant Markdown for a more civilized age by ceejayoz on Wednesday August 03, 2011 @05:01PM (#2843075)
Particularly useful for HTML e-mail - write once and it'll look great in both the plaintext version and the HTML one.
Re:Elegant Markdown for a more civilized age by cormullion on Wednesday August 03, 2011 @05:29PM (#2843199)
It's a writer's tool, rather than a coder's tool. Markdown text is getting on for half as long as equivalent HTML.

        # Subheading
        
        ## Main heading
        
        Plain paragraph.
        
        - bullet
        - bullet
        - bullet
        
        Paragraph.
87 characters in Markdown. 147 in HTML. If I write in HTML, I get distracted from the words by the HTML markup...
Re:Elegant Markdown for a more civilized age by jseliger on Wednesday August 03, 2011 @09:39PM (#2844136)
Ah. Interesting. I use macros in Textmate and Typinator to accomplish more or less the same thing; for example, command-shift-v will enter "<a href=command-v">, with command-v being paste, and command-i will yield italics, and so forth. Still, having something universal, like Markdown, sounds attractive.
Re:Elegant Markdown for a more civilized age by s1rech on Wednesday August 03, 2011 @03:36PM (#2842655)
For blog posts, README's for github and stuff like that the source in markdown kind of looks better than the equivalent HTML tag soup.

In fact, I wouldn't mind if javadoc supported it too.

Re:Elegant Markdown for a more civilized age by bergie on Wednesday August 03, 2011 @04:10PM (#2842818)
Re:Elegant Markdown for a more civilized age by FSX on Wednesday August 03, 2011 @03:39PM (#2842668)
Imagine having to write a few lists or tables in HTML. I think writing Markdown in those cases is a bit faster and much more pleasant.
Re:Elegant Markdown for a more civilized age by pavel_lishin on Wednesday August 03, 2011 @03:56PM (#2842738)
Assuming http://www.leancrew.com/all-this/2008/08/tables-for-markdown... is accurate, HTML tables look much more readable to me. /shrug
Re:Elegant Markdown for a more civilized age by dchest on Wednesday August 03, 2011 @07:59PM (#2843816)
Since it's allowed in HTML to not close <li> tags, lists are pretty readable and easy to write:

    <ul>
      <li>Item 1
      <li>Item 2
      <li>Item 3
    </ul>
Re:Elegant Markdown for a more civilized age by remi on Wednesday August 03, 2011 @03:41PM (#2842680)
Haml is also great for writing <table>'s.
Re:Elegant Markdown for a more civilized age by baddox on Wednesday August 03, 2011 @03:49PM (#2842706)
Markdown is for publishing, whereas Haml is for designers/developers. The point of Markdown is that non-technical users can use it, and it generally looks good and self-explanatory even unrendered.
Re:Elegant Markdown for a more civilized age by tanoku on Wednesday August 03, 2011 @04:37PM (#2842949)
HTML may be easier for you (it certainly is for me), but that's because you are a programmer. You must keep in mind that Markdown targets a very wide audience: you cannot expect your average Reddit user to write emphasis tags every time he wants to say something sarcastic in a comment, and trust me, that's pretty often.

Likewise, you cannot expect the average Joe to remember the syntax of an HTML link tag when writing a comment in your website, but you do need (at least we do) to make sure that the links in your website have certain attributes (rel, target, etc): Hence, customizable Markdown.

Re:Elegant Markdown for a more civilized age by arkitaip on Wednesday August 03, 2011 @03:41PM (#2842676)
This. I find markdown and all its bastards insufficient and their syntax hard to remember. Sometimes you can use _ other times it's * and none of them are more intuitive that <em> or <bold>.
Re:Elegant Markdown for a more civilized age by veeti on Wednesday August 03, 2011 @03:44PM (#2842692)
Actually, it's <strong> and not <bold> ;)
Re:Elegant Markdown for a more civilized age by arkitaip on Wednesday August 03, 2011 @05:59PM (#2843349)
Can't believe I made that mistake ;)
Re:Elegant Markdown for a more civilized age by pavel_lishin on Wednesday August 03, 2011 @03:54PM (#2842732)
Actually, markdown is great for this kind of stuff - it's when you start getting into links, inserting attributes, etc. that I'd rather just write HTML.
Re:Elegant Markdown for a more civilized age by jgroome on Wednesday August 03, 2011 @03:46PM (#2842698)
<strong>.

(Sorry)

Re:Elegant Markdown for a more civilized age by kbd on Wednesday August 03, 2011 @03:53PM (#2842724)
I've always wished _ meant "underline" not <em>. Of course the HTML standard only defines <em> and <strong>, but _ could create output like <em class="underline"> or <em style="text-decoration: underline">.
Re:Elegant Markdown for a more civilized age by shabble on Wednesday August 03, 2011 @11:20PM (#2844359)
I still find myself using /emphasis/ in places, despite nothing I can think of actually supporting it. I can't remember where it originated, possibly usenet.
Re:Elegant Markdown for a more civilized age by mooism2 on Wednesday August 03, 2011 @04:17PM (#2842862)
<u>
Re:Elegant Markdown for a more civilized age by kbd on Wednesday August 03, 2011 @04:57PM (#2843053)
Oh hey, look at that, they un-deprecated <u> in HTML5: http://dev.w3.org/html5/markup/u.html#u

Even more reason for it to be supported in Markdown :)

Re:Elegant Markdown for a more civilized age by cema on Wednesday August 03, 2011 @05:08PM (#2843111)
Yes, the good old <u>, <b> and <i> seem to be going out of fashion. Understandable in the context of web development, but so handy for a short piece of text like a blog post or comment.
Re:Elegant Markdown for a more civilized age by dchest on Wednesday August 03, 2011 @08:47PM (#2843973)
It also encourages putting <em> and <strong> everywhere instead of choosing the proper tag between <em>, <strong>, <b>, <i>, <u>, <cite>, <q>.
Re:Elegant Markdown for a more civilized age by jcoder on Thursday August 04, 2011 @01:17AM (#2844707)
Then you're restricted to HTML. You can parse Markdown and emit LaTeX, HTML, OPML—anything structured.
Re:Elegant Markdown for a more civilized age by rednaught on Wednesday August 03, 2011 @03:44PM (#2842694)
Is there any consensus on an improved/extended Markdown? Between MultiMarkdown, Github Flavored Markdown, Stack Exchange's additions, this new "elegant" markdown and others there seems to be bit of fragmentation in this idea of a simple markup.
Re:Elegant Markdown for a more civilized age by tanoku on Wednesday August 03, 2011 @04:40PM (#2842960)
No, there isn't really a consensus. FWIW, this is not a "new elegant Markdown", this is a 100% standards compilant Markdown library, with optional support for some extensions that we found useful. The syntax for these extensions comes, basically, from the Markdown mailing list and PHP-Markdown Extra.
Re:Elegant Markdown for a more civilized age by technomancy on Wednesday August 03, 2011 @06:12PM (#2843397)
> this is a 100% standards compilant Markdown library

Eh, what's that now? Isn't Markdown implementation-defined? I wasn't aware there was a spec, I thought it was just some notes on a dude's blog.

Re:Elegant Markdown for a more civilized age by guywithabike on Wednesday August 03, 2011 @07:09PM (#2843621)
I think the "Markdown standard" could be considered to be Gruber's official docs: http://daringfireball.net/projects/markdown/syntax
Re:Elegant Markdown for a more civilized age by benatkin on Thursday August 04, 2011 @01:10AM (#2844677)
Yes, it is just some notes on a dude's blog. Well put.
Re:Elegant Markdown for a more civilized age by rednaught on Wednesday August 03, 2011 @06:26PM (#2843452)
I don't know what he meant by that either.
Re:Elegant Markdown for a more civilized age by briteside on Thursday August 11, 2011 @12:41PM (#2873634)
Is Maruku's metadata syntax supported? http://maruku.rubyforge.org/proposal.html
Re:Elegant Markdown for a more civilized age by rednaught on Wednesday August 03, 2011 @06:33PM (#2843484)
Just curious if there was a reason why this is not on the official Github blog?
Re:Elegant Markdown for a more civilized age by stephth on Wednesday August 03, 2011 @07:00PM (#2843587)
Speaking of Markdown and Github, has anyone figured out a way to preview locally - with accuracy - how README.mdown files will look on the project page? Would Redcarpet 2 help solve this problem?
Re:Elegant Markdown for a more civilized age by FSX on Wednesday August 03, 2011 @03:37PM (#2842659)
Nice. I like the idea with the renderers. I'm going to this idea a try too for my Python binding.
Re:Elegant Markdown for a more civilized age by dotemacs on Wednesday August 03, 2011 @04:53PM (#2843029)
Redcarpet is great, but for code highlighting you can use pygments.rb, which has an embedded python in it and is therefore faster than albino.

Check it out: https://github.com/tmm1/pygments.rb

Re:Elegant Markdown for a more civilized age by sukuriant on Wednesday August 03, 2011 @07:14PM (#2843637)
Am I the only one that found the font on that page distracting?
[deleted]
Re:Elegant Markdown for a more civilized age by tedkimble on Wednesday August 03, 2011 @05:15PM (#2843138)
Perhaps because there's multiple 'markdown-ruby's and they all want to be distributed as RubyGems. More importantly, I rather like many of the names!
Re:Elegant Markdown for a more civilized age by mcburton on Wednesday August 03, 2011 @04:04PM (#2842775)
excellent. Maybe now there well be an elegant way to go from .markdown to .docx
Re:Elegant Markdown for a more civilized age by sharkbrainguy on Wednesday August 03, 2011 @05:11PM (#2843123)
Pandoc does that already http://johnmacfarlane.net/pandoc/

Pandoc is written in haskell but there's c bindings to it https://github.com/toyvo/libpandoc so you can use it from anywhere.

Re:Elegant Markdown for a more civilized age by politician on Wednesday August 03, 2011 @04:44PM (#2842977)
docx, why?! You're being sarcastic, right? right?!
Re:Elegant Markdown for a more civilized age by Kwpolska on Thursday August 04, 2011 @06:56AM (#2845400)
Someone shall port this to Python (and possibly PHP).