duckduckgo / community-platform-static

Shared static files of the community platform and related sites
4 stars 4 forks source link

Update CSS for DuckDuckHack Docs code snippets #2

Closed moollaza closed 9 years ago

moollaza commented 9 years ago

This coincides with the changes to Community-Platform which adds syntax highlighting to the DuckDuckHack docs: https://github.com/duckduckgo/community-platform/pull/330

//cc @russellholt @sdougbrown

sdougbrown commented 9 years ago

I feel like the font family thing could be applied to all pre/code/tt blocks, it doesn't need to be constrained to DDH.

Other than that this is fine.

moollaza commented 9 years ago

@sdougbrown I would be happy to apply that font stack everywhere else :)

One other thought I had was to add some background and padding to inline code blocks with something like:

p code {
    background: #e1e1e1;
    padding: 2px 3px;
    border-radius: 2px;
}

The result looks like this:

image

sdougbrown commented 9 years ago

Generally inline code blocks are wrapped in <tt> elements, aren't they? Or is that not how markdown compiles it?

That snippet would probably be fine to add, though - just make sure the big code blocks aren't also wrapped in <p> tags.

moollaza commented 9 years ago

@sdougbrown until you mentioned <tt> I'd actually never seen/heard of it. Looking around on other sites, it seems <code> is what is being used for inline snippets (I just checked FB and Twitter docs pages).

We're using a Perl lib, Markdent, to render our HTML from Markdown, I may be able to tweak it to use <tt> but I'm not sure right now.

That snippet would probably be fine to add, though - just make sure the big code blocks aren't also >wrapped in <p> tags.

As far as I can tell, they're always wrapped in <pre><code> inside our <div class="row content">

moollaza commented 9 years ago

@doug fyi apparently the <tt> tag is deprecated with HTML5, https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tt -- so I guess moving forward with inline <code> is okay

moollaza commented 9 years ago

@sdougbrown here's how it looks with the updated CSS:

2014-12-15_17h48_35

If this is good, please merge :)

sdougbrown commented 9 years ago

Yeah I'm fine with this. :+1:

moollaza commented 9 years ago

awesome, thanks @sdougbrown

moollaza commented 9 years ago

@sdougbrown I noticed these changes aren't live yet on the docs -- does this repo need to be released for the changes to take effect?