[reddit change] New markdown interpreter!

https://www.reddit.com/r/changelog/comments/mg1j6/reddit_change_new_markdown_interpreter/

created by spladug on 17/11/2011 at 20:14 UTC*

164 upvotes, 37 top-level comments (showing 25)

reddit uses Markdown[1] to turn the text you write in comments, subreddit sidebars, etc. into HTML. We've now replaced the existing markdown interpreter with a new one based on GitHub's Sundown[2], which we're calling Snudown[3].

1: http://daringfireball.net/projects/markdown/

2: http://github.com/tanoku/sundown

3: http://github.com/reddit/snudown

In addition to being about 8x faster than the previous interpreter we used, the new interpreter has the following enhancements:

The markdown specification has some gray areas, so there are some minor differences in the rendering of particularly complicated markdown constructs. That said, this is a pretty big change, so if you run into anything funky, please let us know.

Special thanks to tanoku[4] for his help in moving us to Sundown, AnteChronos[5] for writing up a great guide to Markdown[6] which we used to sanity test, intortus[7] for the brilliant name, and slyf[8] for taking it the last mile and fixing the remaining known bugs.

4: http://www.reddit.com/user/tanoku

5: http://www.reddit.com/user/AnteChronos

6: http://www.reddit.com/comments/6ewgt/reddit_markdown_primer_or_how_do_you_do_all_that

7: http://www.reddit.com/user/intortus

8: http://www.reddit.com/user/slyf

9: http://github.com/reddit/snudown/issues

See the code for this change on GitHub[10].

10: https://github.com/reddit/reddit/commit/8865943a4a5115b209895d1e6345ab4cb848e4c0

Comments

Comment by honestbleeps at 17/11/2011 at 21:54 UTC

51 upvotes, 3 direct replies

oh boy...

now I need to find a javascript port of Sundown for Reddit Enhancement Suite to use...

anyone bored / have lots of time on their hands? ;-)

Comment by [deleted] at 17/11/2011 at 20:21 UTC*

27 upvotes, 3 direct replies

Special thanks to *AnteChronos*[1] for providing us with a benchmark and formatting guide[2] to the markdown system three years ago. Some markdown mentioned here is taken from his guide.

1: http://www.reddit.com/user/AnteChronos

2: http://www.reddit.com/comments/6ewgt/reddit_markdown_primer_or_how_do_you_do_all_that

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Our new system supports auto-linking to subreddits, for an example:

We have this new subreddit called /r/askreddit

produces:

We have this new subreddit called /r/askreddit

--------------------------------------------------------------------------------

The new system is a bit more whitespace senstive in some places. For an example:

Do not use

```
** This text is bold **
```

instead use:

```
**This text is bold**
```

Which produces:

**This text is bold**

--------------------------------------------------------------------------------

Nesting lists of two different types is no longer supported. Ie.

1. Item one
2. 
   * Item one
   * Item two
3. Item two

Will no longer produce an unordered list inside an ordered list.

--------------------------------------------------------------------------------

While I am on the subject, nesting lists of the same type is still supported. However, the formatting is a little more strict.

Instead of:

1. Ordered list item 1
2. 1. Bullet 1 in list item 2
   2. Bullet 2 in list item 2
3. List item 3

use

1. Ordered list item 1
2. 
    1. Bullet 1 in list item 2
    2. Bullet 2 in list item 2
3. List item 3

which produces:

1. Ordered list item 1

2. 1. Bullet 1 in list item 2 2. Bullet 2 in list item 2

3. List item 3

--------------------------------------------------------------------------------

Multiple paragraphs inside a list is no longer supported. Or rather, the old trick to make them work no longer works:


(four spaces here)This is the second paragraph

The above is no longer supported.

--------------------------------------------------------------------------------

Tables inside of block-quotes is still supported, however, the formatting is a little more strict.

Do not use:

 The code below:
 >some|header|labels
 :---|:--:|---:
 Left-justified|center-justified|right-justified
 a|b|c
 d|e|f

Instead use:

 The code below:
 >
 some|header|labels
 :---|:--:|---:
 Left-justified|center-justified|right-justified
 a|b|c
 d|e|f

Which produces:

┌────────────────┬──────────────────┬─────────────────┐
│      some      │      header      │     labels      │
╞════════════════╪══════════════════╪═════════════════╡
│ Left-justified │ center-justified │ right-justified │
├────────────────┼──────────────────┼─────────────────┤
│ a              │        b         │               c │
├────────────────┼──────────────────┼─────────────────┤
│ d              │        e         │               f │
└────────────────┴──────────────────┴─────────────────┘

--------------------------------------------------------------------------------

I should also mention that there is a small edge case glitch when trying to place tables inside of code blocks when the only thing inside the code block is a table. If you run into this, simply place some other small text inside the code block along with the table.

--------------------------------------------------------------------------------

A lot of broken tables are around. The problem is that the old system was accepting of incorrect tables. If you have four columns, use:

:---|:---|:---|:---

If you have five:

:---|:---|:---|:---|:---

etc, etc. If you have a post with this issue please simply correct the number of columns in your markdown.

Comment by sparr at 17/11/2011 at 21:12 UTC

19 upvotes, 1 direct replies

The markdown specification has some gray areas

Understatement of the year.

Comment by lunboks at 17/11/2011 at 23:18 UTC

15 upvotes, 0 direct replies

Wait what, **steam://**? Well well, let's see what we can make of this.

Comment by Stalked_Like_Corn at 18/11/2011 at 01:00 UTC

14 upvotes, 3 direct replies

any chance that /user/(username) can be added?

Comment by [deleted] at 17/11/2011 at 20:53 UTC

11 upvotes, 1 direct replies

We've now replaced the existing markdown interpreter with a new one based on GitHub's Sundown, which we're calling Snudown.

haha, that's pretty clever

Comment by chromakode at 17/11/2011 at 20:14 UTC

8 upvotes, 1 direct replies

/r/awesome

Comment by Sephr at 17/11/2011 at 22:14 UTC*

6 upvotes, 1 direct replies

If you support `https:` along with `http:`, you should support `ircs:` along with `irc:`.

Comment by EvilHom3r at 17/11/2011 at 20:22 UTC

4 upvotes, 1 direct replies

A lot of tables seem to be messed up now. Is there a new format for tables we should be aware of? Or is it a bug?

Comment by reseph at 17/11/2011 at 20:20 UTC

3 upvotes, 1 direct replies

http://www.google.com

ssh://localhost

Good thing it's backwards compatible (similar). :P

Comment by [deleted] at 17/11/2011 at 20:58 UTC

3 upvotes, 2 direct replies

Bug: pointy brackets can appear, but if you put text between them they get completely removed, which would make posting HTML in webdev subreddits impossible

Example: < <> > <<>>

This should be the word "test" between pointy brackets: <test>

Comment by elxx at 17/11/2011 at 21:45 UTC*

3 upvotes, 2 direct replies

What if I post a word_with_underscores_now? Does it still italicize the middle?

EDIT: It doesn't! Yay!

Comment by laaabaseball at 18/11/2011 at 02:07 UTC*

3 upvotes, 2 direct replies

Change I noticed, not really a big deal, but affected some stuff of mine:

[Cool Link](http://reddit.com "blah blah :)")

Outputs: Cool Link

It outputted the smiley face as alt text in the old markdown.

Comment by bobindashadows at 18/11/2011 at 04:49 UTC

3 upvotes, 1 direct replies

No `gopher://` linking? So disappointing. My site's gopher mirror[1] will always be a second-class citizen.

1: gopher://carboni.ca/

Comment by [deleted] at 17/11/2011 at 20:26 UTC

2 upvotes, 1 direct replies

Could we possibly get some sizing in the CSS for headings? It doesn't have to be obnoxiously large, but some differentiation would be nice.

Comment by Skuld at 17/11/2011 at 20:26 UTC

2 upvotes, 0 direct replies

Cool changes, thanks.

Comment by Dacvak at 17/11/2011 at 20:48 UTC

2 upvotes, 0 direct replies

This is fantastic. Hoping it leads to easier subreddit discovery for users scanning the comments section.

Comment by timberspine at 17/11/2011 at 22:35 UTC

2 upvotes, 1 direct replies

We have a sidebar pic that used to recognize links like so:

 div.side a[href="http://#title"]:after {...

and insert images /text whenever it encountered that specific markdown

 [](http://#title)

This no longer works ... any workaround for this?

Comment by kjhatch at 18/11/2011 at 15:19 UTC*

2 upvotes, 1 direct replies

This change is breaking one of my subreddit's spoiler tags. The problem seems to be the automatic linking to subreddits. We have been using code like:

[Spoiler](/s "your text")

It's the same format most of the other spoiler-tag-using subreddits now use. The /letter still works for the mouseover title, but one of my tags employs this format:

[Speculation](/? "your text")

And the /? is being parsed as not a link and the previously-safe info on my subreddits back pages is now uncovered.

Can the support for /? be added back, or can this auto-link feature be turned off? If not, is there any chance someone can assist me with a dB call to globally replace the pattern

](/? "

with

](/g "

in my subreddit's posts to fix all the threads that now don't work? :) Any help/info on this is greatly appreciated.

Thanks

Comment by jaxspider at 18/11/2011 at 16:01 UTC

2 upvotes, 1 direct replies

Its been a busy week for you folks, hasn't it?

:d

Comment by [deleted] at 18/11/2011 at 16:46 UTC

2 upvotes, 1 direct replies

can we get magnet:// links in there?

Comment by [deleted] at 17/11/2011 at 21:57 UTC

2 upvotes, 2 direct replies

[deleted]

Comment by agentlame at 18/11/2011 at 00:44 UTC*

4 upvotes, 0 direct replies

/r/invalidreddit

r/invalidreddit

/r/funny

r/funny

www.google.com

mail.google.com

google.com

http://google.com

http://www.google.com

ftp://mozilla.com

http://www.invalidredit404nowaythisdomainexists.com

/r/funny

Comment by [deleted] at 17/11/2011 at 20:54 UTC*

1 upvotes, 1 direct replies

[deleted]

Comment by [deleted] at 17/11/2011 at 22:51 UTC

1 upvotes, 0 direct replies

I hope this didn't break too many spoiler tags.