Cleaner RDoc Styles

Motivation

RDoc is a really nice code-comment documentation generator to be honest, and compared to my experiences with other systems where you have to prefix ugly ‘@’ symbols all over the place, along with do other nasty things like give type hints (in the cast of messy PHP which doesn’t seem to know if it should use C style weak typing or Java’s strong typing). However, I do think that nearly all doc-comment systems seem to have awful CSS styling by default.

Below is a cut and paste CSS style sheet you can use to replace the default rdoc-styles.css file. You also might want to replace the index.html file with the version I provide here if you want a left aligned frame-set like the Ruby on Rails API Docs

Example Pages

You probably want to take a peek to see what all the rage is about. Well I’m currently using these styles for the TypeFace Documentation Site

The Code

Just copy and paste this, and use freely in your projects. Treat loosely it like Creative Commons Share Alike license. If you can give me a link back to here, to spread the word, I’d be grateful, but it’s not required if you don’t want to. If you do use these, it would be nice to know that others have found my CSS useful, if want to drop me an email I’d be grateful, let me know the URL of your project if it’s on-line.

index.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Rails Framework Documentation</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<frameset cols="25%,*">
    <frameset rows="15%,35%,50%">
        <frame src="fr_file_index.html"   title="Files" name="Files" />
        <frame src="fr_class_index.html"  name="Classes" />

        <frame src="fr_method_index.html" name="Methods" />
    </frameset>
      <frame  src="files/doc/README_FOR_APP.html" name="docwin">
    <noframes>
          <body bgcolor="white">
            Click <a href="html/index.html">here</a> for a non-frames
            version of this page.
          </body>
    </noframes>
</frameset>

</html>

rdoc-styles.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
body {
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: 11px;
  padding: 0 16px;
  margin: 0;
  background: white;
  line-height: 1.7em;
}

h1,
h2,
h3,
h4 { 
  margin: 0; 
  color: white; 
  background: transparent; 
  font-family: "Arial Unicode MS", Verdana, Arial, Helvetica, sans-serif;
}
h1 { 
  font-size: 1.5em; 
}

h2,
h3,
h4 { 
  margin-top: 1em; 
}

h3 {
  font-size: 1.25em;
}

a { 
  color: #039; 
  text-decoration: none; 
}

a:hover { 
  color: #006;
  border-bottom: 1px solid #63abe9;
}

/* Override the base stylesheet's Anchor inside a table cell */
td > a {
  background: transparent;
  color: #039;
  text-decoration: none;
}

/* and inside a section title */
.section-title > a {
  background: transparent;
  color: #eee;
  text-decoration: none;
}

td {
  font-size: 11px;
}

/* === Structural elements =================================== */

div#index {
    margin: 0 -16px;
    padding: 0 0.7em;
    font-size: 0.9em;
    line-height: 1.4em;
}


div#index a {
    white-space: nowrap;
}

div#index a:hover {
  font-weight: bold;
}

div#index .section-bar {
   padding: 0.3em 0.7em;
   background: #ccc;
   font-size: 1.3em;
   margin: 0 -0.7em 0.5em -0.7em;
}

div#classHeader, div#fileHeader {
    width: auto;
    color: white;
    padding: 0.5em 1.5em 0.5em 1.5em;
    margin: 0 -16px;
    border-bottom: 3px solid #006;
}

div#classHeader a, div#fileHeader a {
    background: inherit;
    color: white;
}

div#classHeader td, div#fileHeader td {
    background: inherit;
    color: white;
}


div#fileHeader {
    background: #057;
}

div#classHeader {
    background: #048;
}

.header-table td {
  vertical-align: baseline;
  border: 0 none;
}

.class-name-in-header {
  font-size:  2.3em;
  font-weight: normal;
  font-weight: bold;
  font-family: "Arial Unicode MS", Verdana, Arial, Helvetica, sans-serif;
}


div#bodyContent {
    padding: 0;
    margin: 0;
}

div#description {
    padding: 1em 1em 0.5em 1em;
    background: #f8f8f8;
    border: 1px solid #ddd;
    margin: 2em 0 0 0;
}

div#description h1,h2,h3,h4,h5,h6 {
    color: #125;
    background: transparent;
}

div#description h1 {
    color: #004663;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.25em;
    font-weight: normal
}

div#validator-badges {
    text-align: center;
}
div#validator-badges img { border: 0; }

div#copyright {
    color: #333;
    background: #efefef;
    font: 0.75em sans-serif;
    margin-top: 5em;
    margin-bottom: 0;
    padding: 0.5em 2em;
}


/* === Classes =================================== */

table.header-table {
    color: white;
    font-size: 0.8em;
}

.type-note {
    font-size: 0.8em;
    color: #DEDEDE;
}

.xxsection-bar {
    background: #eee;
    color: #333;
    padding: 3px;
}

.section-bar {
   color: #333;
   border-bottom: 1px solid #999;
}


.section-title {
    background: #79a;
    color: #eee;
    padding: 3px;
    margin-top: 2em;
    margin-left: -30px;
    border: 1px solid #999;
}

table {
  border-collapse: collapse;
}

td {
  padding: 4px 20px 4px 0;
  border-bottom: 1px solid #eee;
}

.top-aligned-row {  vertical-align: top }
.bottom-aligned-row { vertical-align: bottom }

/* --- Context section classes ----------------------- */

.context-row { }
.context-item-name { font-family: monospace; font-weight: bold; color: black; }
.context-item-value { color: #448; }
.context-item-desc { color: #333;  }

/* --- Method classes -------------------------- */
.method-detail {
    background: #f8f8f8;
    padding: 0;
    margin-top: 0.5em;
    margin-bottom: 1em;
    border: 1px solid #ddd;
}
.method-heading {
  color: black;
  background: #ddd;
  border-bottom: 1px solid #ccc;
  padding: 0.2em 0.5em 0 0.5em;
}
.method-signature { color: black; background: inherit; }
.method-name { font-weight: bold; }
.method-args { font-style: italic; }
.method-description { padding: 0 0.5em 0 0.5em; }

/* --- Source code sections -------------------- */

a.source-toggle { font-size: 0.9em; }
div.method-source-code {
    background: black;
    color: #ffdead;
    margin: 1em 0;
    padding: 0 1em;
    border: 1px solid #999;
    overflow: hidden;
}

div.method-source-code pre { 
  color: #aaa; 
  overflow: hidden; 
  font-family: "Lucida Console", "Bitstream Vera Sans Mono", monospace;
}

/* --- Ruby keyword styles --------------------- */

.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }

.ruby-constant  { color: #d00; background: transparent; font-weight: bold; }
.ruby-keyword { color: #f60; background: transparent; font-weight: bold; }
.ruby-ivar    { color: white; background: transparent; }
.ruby-operator  { color: #00ffea; background: transparent; }
.ruby-identifier { color: white; background: transparent; }
.ruby-node    { color: #fe6e34; background: transparent; }
.ruby-comment { color: #0e7e92; font-weight: bold; background: transparent; }
.ruby-regexp  { color: #ffa07a; background: transparent; }
.ruby-value   { color: #05dfdc; background: transparent; }

Listening to Compilation / Trip Hop:
Another Late Night - Kid Loco

Free Designs

Below are a handful of open source / free web designs