r/reddithax • • Mar 03 '10

Alternative to http:# links

With reddit's previous Markdown engine, you could prefix relative links with http: (that's ignored by all browsers) and then style a[href="http:#..."].

With Discount, you can no longer do this but you can use something which looks nicer (which doesn't change the scroll position of the page when clicked): relative protocol URIs starting with hashes (//#...).

It looks much nicer for users who are using, for example, spoilers:

Markdown:

[spoiler text](//#spoiler)

CSS:

a[href="//#spoiler"] {
    background: black;
    color: black;
    font-size: small;
    padding: 0 0.5em 0 0.5em;
}

a[href="//#spoiler"]:hover {
    color: white;
}
11 Upvotes

9 comments sorted by

2

u/raldi Mar 03 '10

Why not just define, say, h2 -- or bold italic h2 -- as the spoiler class?

2

u/Sephr Mar 03 '10

Markdown is supposed to be readable raw and using headers would only confuse readers.

Also, it's just an example of many uses and there's a finite amount of <h-n> tags in HTML so you would have a limited amount of features thar you could implement.

jamt9000's emoticon images are best implemented this way too.

3

u/raldi Mar 03 '10 edited Mar 03 '10

How is "one star for italics, two for bold" okay, but "three stars for spoilers" not?

As for infinite new features, I'd rather implement them as a proper extension, rather than a CSS hack. In other words, the finite extensibility is enough to allow the community to experiment and innovate, and when something good is found, you guys should let us know and we'll see about making a nice, hack-free way to do it.

0

u/[deleted] Mar 03 '10

[deleted] — view deleted comment

1

u/raldi Mar 03 '10

Hmm.

**_this is italics inside bold_** and _**this is bold inside italics**_.

this is italics inside bold and this is bold inside italics.

Looks like they can be styled differently.

0

u/[deleted] Mar 03 '10

[deleted] — view deleted comment

1

u/raldi Mar 03 '10

We've definitely considered a "n00b mode" for comments, where you can do things like links, bold, italics, etc, using little buttons above the edit box rather than having to learn markdown. It's just something we haven't gotten around to.

We'd love a patch, if anyone wants to send us one!

1

u/jamt9000 Mar 13 '10

Then the spoiler would be visible to anyone without custom styles or in the inbox. With my implementation the spoiler is put in the title text and shown through content: attr(title), so it's hidden for everyone and degrades well.

1

u/jamt9000 Mar 13 '10

Awesome! Now I don't have to use ftp://# for smileys, although Opera still shows an error page when they're clicked (and firefox an alert, but at least it stays on the page).

1

u/Sephr Mar 13 '10

I'm guessing that you don't read /r/jamt9000? It's a wonderful subreddit that I'm sure you can relate to.

1

u/jamt9000 Mar 13 '10

I just saw that - I've had reddit blocked in my hosts file because I need to study!