├── .editorconfig ├── .gitignore ├── .godir ├── Procfile ├── README.md ├── docs ├── custom-layouts.md ├── development.md ├── example.md ├── index.md ├── screen.css └── template.html ├── go.mod ├── go.sum ├── viewdocs.go └── viewdocs_test.go /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.go] 13 | indent_size = 4 14 | indent_style = tab 15 | 16 | [Makefile] 17 | indent_size = 4 18 | indent_style = tab 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, build with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Build output 15 | build/* 16 | 17 | # Release output 18 | release/* 19 | 20 | # .env files 21 | .env* 22 | 23 | viewdocs 24 | .env 25 | -------------------------------------------------------------------------------- /.godir: -------------------------------------------------------------------------------- 1 | viewdocs 2 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: viewdocs -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Viewdocs 2 | 3 | Viewdocs is [Read the Docs](https://readthedocs.org/) meets [Gist.io](http://gist.io/) for simple Markdown project documentation. 4 | 5 | See it in action at http://viewdocs.io/ 6 | -------------------------------------------------------------------------------- /docs/custom-layouts.md: -------------------------------------------------------------------------------- 1 | # Custom Layouts 2 | 3 | Viewdocs.io requires a layout template in order to render your markdown pages. The layout file, template.html, must be located at the root of your docs directory. A default layout is included - and was used to render the page you are currently reading. Developing a custom layout is simple, as long as certain constraints are accomodated. 4 | 5 | ## Template Tags 6 | 7 | Template tags are case sensitive upper case identifiers. The following tags are supported: 8 | 9 | 1. {{USER}} - the Github user name of the repository 10 | 2. {{NAME}} - the name of the repository 11 | 3. {{CONTENT}} - the contents of the markdown document when rendered 12 | 4. {{PAGE_CLASS}} - a css class representation of the current url 13 | 5. {{REF}} - the current repository reference, usually master 14 | 5. {{DOC}} - the name of the markdown file being viewed. 15 | 16 | Here's a sample Bootstrap & Angularjs based template: 17 | 18 | ```html 19 | 20 | 21 |
22 | 23 |`: 18 | 19 | > Now that we know who you are, I know who I am. I'm not a mistake! It all makes sense! In a comic, you know how you can tell who the arch-villain's going to be? He's the exact opposite of the hero. And most times they're friends, like you and me! I should've known way back when... You know why, David? Because of the kids. They called me Mr Glass. 20 | 21 | #### This is a fourth-level heading 22 | 23 | Down here we are quite in the weeds already. I guess this is a good a time as any to say that lists are appropriately styled: 24 | 25 | ##### Milkshake ingredients to get at the supermarket 26 | 27 | * Bananas 28 | * Cocoa 29 | * Milk 30 | 31 | _Add bananas, chocolate milk powder, and milk to blender. Blend at high-speed until suitably frothy. Drink and then instagram a pic of your milkshake moustache for extra hipster cool points or something._ 32 | 33 | ##### Steps to recovery from milkshake addiction 34 | 35 | 1. Discard your blender to remove temptation. 36 | 2. Don't make milkshakes. 37 | 3. Repeat step 2 until unreasonable desire for milkshakes has abated. 38 | 39 | By the way, the "Milkshakes ingredients" subtitle was a fifth-level heading. It's rare that you need those, and I don't think you'll ever need a H6, so I didn't style those at all. 40 | 41 | Since you've come this far, you are probably wondering why I don't support something you want me to support. You can help make Viewdocs better by [contributing to the project](https://github.com/progrium/viewdocs) or [filing a bug/feature request](https://github.com/progrium/viewdocs/issues). 42 | 43 | ## Also: Syntax highlighting 44 | 45 | By referencing a [pygments](http://pygments.org/) stylesheet on your docs layout, you'll get some nice looking code blocks, just like you do on your READMEs hosted on GitHub. 46 | 47 | Here's some Ruby code: 48 | 49 | ```ruby 50 | class User 51 | attr_accessor :name, :email, :password 52 | def valid_password?(password) 53 | password == 'WAT?!' 54 | end 55 | end 56 | ``` 57 | 58 | And some Golang code: 59 | 60 | ```go 61 | package main 62 | import "fmt" 63 | 64 | func main() { 65 | fmt.Println("Hello world!") 66 | } 67 | ``` 68 | 69 | ## Also: images 70 | 71 | You can embed images in posts too, and they'll respect the width of your browser: 72 | 73 |74 | 75 | *A photo a woman bathing in the Ganges river* -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Welcome to Viewdocs 2 | 3 | Viewdocs is [Read the Docs](https://readthedocs.org/) meets [Gist.io](http://gist.io/) for simple project documentation. It renders Markdown from your repository's `docs` directory as simple static pages. 4 | 5 | ### Getting Started 6 | 7 | Just make a `docs` directory in your Github project repository and put an `index.md` file in there to get started. Then browse to: 8 | 9 | http://
.viewdocs.io/ 10 | 11 | Any other Markdown files in your `docs` directory are available as a subpath, including files in directories. You can update pages by just pushing to your repository or editing directly on Github. It can take up to 1-2 minutes before changes will appear. 12 | 13 | This page is an example of what documentation will look like by default. Here is [another example page](/viewdocs/example). The source for these pages are in the [docs directory](https://github.com/progrium/viewdocs/tree/master/docs) of the Viewdocs project. 14 | 15 | ### Preview changes before pushing documentation back the repository 16 | 17 | If you want to find out how things look like locally before pushing your code back to the remote repository, you might want to try out [`previewdocs`](http://fgrehm.viewdocs.io/previewdocs). 18 | 19 | ### Advanced Usage 20 | 21 | You can show documentation for different [branches](http://inconshreveable.viewdocs.io/ngrok~master/DEVELOPMENT) or [tags](http://discourse.viewdocs.io/discourse~v0.9.6/INSTALL-ubuntu) of a repository by including a reference name after a tilde in the repository part of the path. It would look like this: 22 | 23 | http:// .viewdocs.io/ ~ 24 | 25 | You can also customize the look and layout of your docs. Make your own `docs/template.html` based on the [default template](https://github.com/progrium/viewdocs/blob/master/docs/template.html) and your pages will be rendered with that template. If you create a `home.html` template, this will be used for your project's landing page. 26 | 27 | Redirects are supported for users who wish to move around files in their documentation structure. Simply create a `docs/viewdocs.json` file and specify your redirects like so: 28 | 29 | ```json 30 | { 31 | "redirects": { 32 | "configuration-management": "configuration/environment-variables/" 33 | } 34 | } 35 | ``` 36 | 37 | This will result in the url `/REPOSITORY/configuration-management/` being redirected to `/REPOSITORY/configuration/environment-variables/` url. 38 | 39 | I also highly recommend you [read the source](https://github.com/progrium/viewdocs/blob/master/viewdocs.go) to this app. It's less than 500 lines of Go. If you want to hack on Viewdocs, [check this out](/viewdocs/development). 40 | 41 |
42 | Enjoy!
43 | [Jeff Lindsay](http://twitter.com/progrium) 44 | -------------------------------------------------------------------------------- /docs/screen.css: -------------------------------------------------------------------------------- 1 | * { 2 | -webkit-box-sizing: border-box; 3 | -moz-box-sizing: border-box; 4 | box-sizing: border-box; } 5 | 6 | html { 7 | background-color: #fff; 8 | padding: 0; 9 | margin: 0; 10 | width: 100%; } 11 | 12 | body { 13 | width: 100%; 14 | height: 100%; 15 | padding: 1em; 16 | margin: 0; 17 | font-family: 'Sentinel SSm A', 'Sentinel SSm B', Georgia, serif; 18 | color: #444; 19 | font-weight: 300; } 20 | 21 | a { 22 | color: #4da7ca; 23 | -webkit-transition: all 0.15s ease-out 0; 24 | -moz-transition: all 0.15s ease-out 0; 25 | transition: all 0.15s ease-out 0; } 26 | a:hover, a:visited:hover { 27 | color: #296e88; } 28 | a:visited { 29 | color: #88c4dc; } 30 | 31 | .content { 32 | padding: 0.809em; 33 | max-width: 30em; 34 | margin: auto; } 35 | .content #gistid { 36 | font-weight: normal; 37 | color: #ccc; 38 | font-size: 0.8em; } 39 | .content #gistid a { 40 | color: #ccc; 41 | text-decoration: none; } 42 | .content #gistid a:hover { 43 | text-decoration: underline; } 44 | .content #description { 45 | font-family: 'Tungsten A', 'Tungsten B'; 46 | font-weight: 500; 47 | font-size: 5em; 48 | text-transform: uppercase; 49 | line-height: 1em; } 50 | .content #description.loading { 51 | -webkit-animation: throb 1s infinite alternate linear; 52 | -moz-animation: throb 1s infinite alternate linear; 53 | -ms-animation: throb 1s infinite alternate linear; 54 | -o-animation: throb 1s infinite alternate linear; } 55 | .content .apology { 56 | font-style: italic; 57 | color: #aaa; } 58 | .content > footer { 59 | margin-top: 4em; 60 | margin-bottom: 2em; 61 | border-top: 1px solid #eee; 62 | display: none; } 63 | .content > footer.forceshow { 64 | display: block; } 65 | .content > footer p { 66 | font-size: 0.8em; 67 | color: #888; 68 | font-style: italic; } 69 | .content > footer p .poweredby { 70 | display: inline-block; 71 | margin-right: 1em; } 72 | 73 | article > h1:first-child { 74 | display: none; } 75 | article h1, article h2, article h3, article h4, article h5 { 76 | font-weight: 300; 77 | margin-top: 2em; 78 | color: black; } 79 | article h1, article h2 { 80 | font-size: 1.5em; } 81 | article h3 { 82 | font-weight: 400; 83 | font-size: 0.925em; 84 | margin-top: 3em; 85 | text-transform: uppercase; } 86 | article h4, article h5, article h6 { 87 | font-weight: 400; 88 | font-size: 0.925em; 89 | margin-top: 3em; 90 | font-style: italic; } 91 | article ul, article ol { 92 | list-style-position: outside; 93 | padding: 0; } 94 | article blockquote { 95 | margin: 0; 96 | padding-left: 1em; 97 | border-left: 1px solid #ddd; } 98 | article ul, article ol, article p, article blockquote { 99 | line-height: 1.5em; } 100 | article img, article object, article video, article audio, article figure, article iframe { 101 | max-width: 100%; } 102 | article pre, article code, article samp { 103 | font-family: 'Source Code Pro', monospace; } 104 | article .highlight { 105 | padding: 0.1em 0.5em; 106 | background: #1d1f21; 107 | font-size: 0.88em; } 108 | 109 | @media all and (min-width: 33.236em) { 110 | .content { 111 | padding: 1.618em; 112 | margin: 0 auto; 113 | max-width: 45rem; 114 | font-size: 1.125em; } } 115 | @-webkit-keyframes throb { 116 | 0% { 117 | opacity: 0.25; } 118 | 119 | 100% { 120 | opacity: 1; } } 121 | 122 | @-moz-keyframes throb { 123 | 0% { 124 | opacity: 0.25; } 125 | 126 | 100% { 127 | opacity: 1; } } 128 | 129 | @-ms-keyframes throb { 130 | 0% { 131 | opacity: 0.25; } 132 | 133 | 100% { 134 | opacity: 1; } } 135 | 136 | @-o-keyframes throb { 137 | 0% { 138 | opacity: 0.25; } 139 | 140 | 100% { 141 | opacity: 1; } } 142 | 143 | .highlight .hll { 144 | background-color: #373b41; } 145 | 146 | .highlight { 147 | background: #1d1f21; 148 | color: #c5c8c6; } 149 | 150 | .highlight .c { 151 | color: #969896; } 152 | 153 | /* Comment */ 154 | .highlight .err { 155 | color: #cc6666; } 156 | 157 | /* Error */ 158 | .highlight .k { 159 | color: #b294bb; } 160 | 161 | /* Keyword */ 162 | .highlight .l { 163 | color: #de935f; } 164 | 165 | /* Literal */ 166 | .highlight .n { 167 | color: #c5c8c6; } 168 | 169 | /* Name */ 170 | .highlight .o { 171 | color: #8abeb7; } 172 | 173 | /* Operator */ 174 | .highlight .p { 175 | color: #c5c8c6; } 176 | 177 | /* Punctuation */ 178 | .highlight .cm { 179 | color: #969896; } 180 | 181 | /* Comment.Multiline */ 182 | .highlight .cp { 183 | color: #969896; } 184 | 185 | /* Comment.Preproc */ 186 | .highlight .c1 { 187 | color: #969896; } 188 | 189 | /* Comment.Single */ 190 | .highlight .cs { 191 | color: #969896; } 192 | 193 | /* Comment.Special */ 194 | .highlight .gd { 195 | color: #cc6666; } 196 | 197 | /* Generic.Deleted */ 198 | .highlight .ge { 199 | font-style: italic; } 200 | 201 | /* Generic.Emph */ 202 | .highlight .gh { 203 | color: #c5c8c6; 204 | font-weight: bold; } 205 | 206 | /* Generic.Heading */ 207 | .highlight .gi { 208 | color: #b5bd68; } 209 | 210 | /* Generic.Inserted */ 211 | .highlight .gp { 212 | color: #969896; 213 | font-weight: bold; } 214 | 215 | /* Generic.Prompt */ 216 | .highlight .gs { 217 | font-weight: bold; } 218 | 219 | /* Generic.Strong */ 220 | .highlight .gu { 221 | color: #8abeb7; 222 | font-weight: bold; } 223 | 224 | /* Generic.Subheading */ 225 | .highlight .kc { 226 | color: #b294bb; } 227 | 228 | /* Keyword.Constant */ 229 | .highlight .kd { 230 | color: #b294bb; } 231 | 232 | /* Keyword.Declaration */ 233 | .highlight .kn { 234 | color: #8abeb7; } 235 | 236 | /* Keyword.Namespace */ 237 | .highlight .kp { 238 | color: #b294bb; } 239 | 240 | /* Keyword.Pseudo */ 241 | .highlight .kr { 242 | color: #b294bb; } 243 | 244 | /* Keyword.Reserved */ 245 | .highlight .kt { 246 | color: #f0c674; } 247 | 248 | /* Keyword.Type */ 249 | .highlight .ld { 250 | color: #b5bd68; } 251 | 252 | /* Literal.Date */ 253 | .highlight .m { 254 | color: #de935f; } 255 | 256 | /* Literal.Number */ 257 | .highlight .s { 258 | color: #b5bd68; } 259 | 260 | /* Literal.String */ 261 | .highlight .na { 262 | color: #81a2be; } 263 | 264 | /* Name.Attribute */ 265 | .highlight .nb { 266 | color: #c5c8c6; } 267 | 268 | /* Name.Builtin */ 269 | .highlight .nc { 270 | color: #f0c674; } 271 | 272 | /* Name.Class */ 273 | .highlight .no { 274 | color: #cc6666; } 275 | 276 | /* Name.Constant */ 277 | .highlight .nd { 278 | color: #8abeb7; } 279 | 280 | /* Name.Decorator */ 281 | .highlight .ni { 282 | color: #c5c8c6; } 283 | 284 | /* Name.Entity */ 285 | .highlight .ne { 286 | color: #cc6666; } 287 | 288 | /* Name.Exception */ 289 | .highlight .nf { 290 | color: #81a2be; } 291 | 292 | /* Name.Function */ 293 | .highlight .nl { 294 | color: #c5c8c6; } 295 | 296 | /* Name.Label */ 297 | .highlight .nn { 298 | color: #f0c674; } 299 | 300 | /* Name.Namespace */ 301 | .highlight .nx { 302 | color: #81a2be; } 303 | 304 | /* Name.Other */ 305 | .highlight .py { 306 | color: #c5c8c6; } 307 | 308 | /* Name.Property */ 309 | .highlight .nt { 310 | color: #8abeb7; } 311 | 312 | /* Name.Tag */ 313 | .highlight .nv { 314 | color: #cc6666; } 315 | 316 | /* Name.Variable */ 317 | .highlight .ow { 318 | color: #8abeb7; } 319 | 320 | /* Operator.Word */ 321 | .highlight .w { 322 | color: #c5c8c6; } 323 | 324 | /* Text.Whitespace */ 325 | .highlight .mf { 326 | color: #de935f; } 327 | 328 | /* Literal.Number.Float */ 329 | .highlight .mh { 330 | color: #de935f; } 331 | 332 | /* Literal.Number.Hex */ 333 | .highlight .mi { 334 | color: #de935f; } 335 | 336 | /* Literal.Number.Integer */ 337 | .highlight .mo { 338 | color: #de935f; } 339 | 340 | /* Literal.Number.Oct */ 341 | .highlight .sb { 342 | color: #b5bd68; } 343 | 344 | /* Literal.String.Backtick */ 345 | .highlight .sc { 346 | color: #c5c8c6; } 347 | 348 | /* Literal.String.Char */ 349 | .highlight .sd { 350 | color: #969896; } 351 | 352 | /* Literal.String.Doc */ 353 | .highlight .s2 { 354 | color: #b5bd68; } 355 | 356 | /* Literal.String.Double */ 357 | .highlight .se { 358 | color: #de935f; } 359 | 360 | /* Literal.String.Escape */ 361 | .highlight .sh { 362 | color: #b5bd68; } 363 | 364 | /* Literal.String.Heredoc */ 365 | .highlight .si { 366 | color: #de935f; } 367 | 368 | /* Literal.String.Interpol */ 369 | .highlight .sx { 370 | color: #b5bd68; } 371 | 372 | /* Literal.String.Other */ 373 | .highlight .sr { 374 | color: #b5bd68; } 375 | 376 | /* Literal.String.Regex */ 377 | .highlight .s1 { 378 | color: #b5bd68; } 379 | 380 | /* Literal.String.Single */ 381 | .highlight .ss { 382 | color: #b5bd68; } 383 | 384 | /* Literal.String.Symbol */ 385 | .highlight .bp { 386 | color: #c5c8c6; } 387 | 388 | /* Name.Builtin.Pseudo */ 389 | .highlight .vc { 390 | color: #cc6666; } 391 | 392 | /* Name.Variable.Class */ 393 | .highlight .vg { 394 | color: #cc6666; } 395 | 396 | /* Name.Variable.Global */ 397 | .highlight .vi { 398 | color: #cc6666; } 399 | 400 | /* Name.Variable.Instance */ 401 | .highlight .il { 402 | color: #de935f; } 403 | 404 | /* Literal.Number.Integer.Long */ 405 | 406 | /* 407 | FILE ARCHIVED ON 05:50:09 Feb 20, 2019 AND RETRIEVED FROM THE 408 | INTERNET ARCHIVE ON 00:02:47 Aug 11, 2019. 409 | JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. 410 | 411 | ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. 412 | SECTION 108(a)(3)). 413 | */ 414 | /* 415 | playback timings (ms): 416 | exclusion.robots: 0.153 417 | load_resource: 191.359 418 | RedisCDXSource: 27.217 419 | PetaboxLoader3.datanode: 211.343 (5) 420 | LoadShardBlock: 137.933 (3) 421 | esindex: 0.007 422 | exclusion.robots.policy: 0.143 423 | CDXLines.iter: 10.286 (3) 424 | captures_list: 178.089 425 | PetaboxLoader3.resolve: 112.717 (2) 426 | */ 427 | -------------------------------------------------------------------------------- /docs/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |{{NAME}} :: viewdocs.io 5 | 6 | 7 | 8 | 9 | 21 | 22 | 23 |24 | 31 | 39 | 40 | 41 | 42 | 43 |25 | 27 |{{NAME}} :: index
26 |28 | {{CONTENT}} 29 | 30 |