madness 0.9.9 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +74 -76
  3. data/app/public/css/main.css +494 -248
  4. data/app/public/css/main.css.map +30 -24
  5. data/app/public/font/fontello.eot +0 -0
  6. data/app/public/font/fontello.svg +16 -0
  7. data/app/public/font/fontello.ttf +0 -0
  8. data/app/public/font/fontello.woff +0 -0
  9. data/app/public/font/fontello.woff2 +0 -0
  10. data/app/public/js/clipboard.js +2 -2
  11. data/app/styles/_anchor.scss +5 -3
  12. data/app/styles/_breadcrumbs.scss +2 -1
  13. data/app/styles/_code.scss +35 -42
  14. data/app/styles/{_icons.scss → _fontello.scss} +28 -19
  15. data/app/styles/_footnotes.scss +5 -0
  16. data/app/styles/_general.scss +7 -3
  17. data/app/styles/_image.scss +0 -2
  18. data/app/styles/_keyboard.scss +8 -7
  19. data/app/styles/_line.scss +1 -26
  20. data/app/styles/_manifest.scss +12 -8
  21. data/app/styles/_nav.scss +5 -15
  22. data/app/styles/_rouge.scss +213 -0
  23. data/app/styles/_scrollbar.scss +9 -0
  24. data/app/styles/_search.scss +5 -6
  25. data/app/styles/_table.scss +12 -7
  26. data/app/styles/_typography.scss +9 -5
  27. data/app/styles/_variables.scss +40 -0
  28. data/app/styles/main.scss +3 -3
  29. data/app/views/_index_nav.slim +6 -5
  30. data/app/views/document.slim +2 -6
  31. data/bin/madness +6 -2
  32. data/lib/madness/cli.rb +21 -0
  33. data/lib/madness/commands/base.rb +11 -0
  34. data/lib/madness/commands/config.rb +48 -0
  35. data/lib/madness/commands/server.rb +76 -0
  36. data/lib/madness/commands/theme.rb +36 -0
  37. data/lib/madness/document.rb +5 -110
  38. data/lib/madness/exceptions.rb +6 -0
  39. data/lib/madness/highlight_renderer.rb +10 -0
  40. data/lib/madness/markdown_document.rb +103 -0
  41. data/lib/madness/server_base.rb +1 -1
  42. data/lib/madness/settings.rb +7 -7
  43. data/lib/madness/templates/madness.yml +6 -4
  44. data/lib/madness/version.rb +1 -1
  45. metadata +53 -50
  46. data/app/public/fonts/fontello.eot +0 -0
  47. data/app/public/fonts/fontello.svg +0 -16
  48. data/app/public/fonts/fontello.ttf +0 -0
  49. data/app/public/fonts/fontello.woff +0 -0
  50. data/app/public/fonts/fontello.woff2 +0 -0
  51. data/app/styles/_coderay.scss +0 -37
  52. data/lib/madness/command_line.rb +0 -139
  53. data/lib/madness/docopt.txt +0 -98
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e5aec00c5e1b2645ddd8df0791c72f1f9b1dac802bf9f8ebbec7ee82adf9af3
4
- data.tar.gz: b4813953be6a17acc191e98b000470351849703d33def5c6b1783d8670b3bebf
3
+ metadata.gz: b9cba6f044834b3b940828d81932f1537e289fdb39f7c4b6c91d5941b1fc441b
4
+ data.tar.gz: 5d281aa6e131eda5c3f41622b34d2c82ea57ff93677de035c4e55475988c5d28
5
5
  SHA512:
6
- metadata.gz: 4ea3389d117c99fae165537c8bd6f9b6702faded54d20ca3100bb543b5f137d3643573baa1186a62cc65acc772513824a1de88a73610eef3c6817675f7cff462
7
- data.tar.gz: acf4925d81080002ff39c295ec0dcb78dcdd8ee8e3b306893be27ca1be4858481552bdb09756b89b6e76c6fca91bcf5512a9c9c75d59d25662400d3ead725587
6
+ metadata.gz: 3ecf906622256765245b7a5b5955aab19e6abd26cec1d63cb7a578add0880ade75b4ba2cb27638db9c2e45300ec57f064057ce4bc5cbb113001ba81e9e6aa00a
7
+ data.tar.gz: 90bba0e9ac05b6674e1691761f319e7dac8cfb9c9d2999ed428753ddad3e4facf288540d441f23e647513c077861c4431404cd75d933c9d7f36f14a1f9475f4b
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Madness Logo](assets/header.png)](https://github.com/dannyben/madness)
2
+
1
3
  # Madness - Instant Markdown Server
2
4
 
3
5
  [![Gem Version](https://badge.fury.io/rb/madness.svg)](https://badge.fury.io/rb/madness)
@@ -6,34 +8,20 @@
6
8
 
7
9
  ---
8
10
 
9
- ## Screenshots (click to zoom)
10
-
11
- <table><tr>
12
- <td><a target='_screenshot' href='assets/screen-main.png'><img src='assets/screen-main.png'/></a></td>
13
- <td><a target='_screenshot' href='assets/screen-nav.png'><img src='assets/screen-nav.png'/></a></td>
14
- <td><a target='_screenshot' href='assets/screen-code.png'><img src='assets/screen-code.png'/></a></td>
15
- <td><a target='_screenshot' href='assets/screen-search.png'><img src='assets/screen-search.png'/></a></td>
16
- </tr></table>
17
-
18
- ## Table of Contents
19
-
20
- * [Install](#install)
21
- * [Design Intentions](#design-intentions)
22
- * [Feature Highlights](#feature-highlights)
23
- * [Usage](#usage)
24
- * [Directory Conventions](#directory-conventions)
25
- * [Configuration File](#configuration-file)
26
- * [Search](#search)
27
- * [Images and Static Files](#images-and-static-files)
28
- * [Automatic H1](#automatic-h1)
29
- * [Shortlinks](#shortlinks)
30
- * [Table of Contents Generation](#table-of-contents-generation)
31
- * [Hidden Directories](#hidden-directories)
32
- * [Controlling Sort Order](#controlling-sort-order)
33
- * [Displaying Additional File Types](#displaying-additional-file-types)
34
- * [Basic Authentication](#basic-authentication)
35
- * [Customizing Theme](#customizing-theme)
36
- * [Docker Image](#docker-image)
11
+ Madness is a command line server for rendering markdown documents in your
12
+ browser. It is designed to facilitate easy development of internal
13
+ markdown-based documentation site.
14
+
15
+ <!-- MADNESS_TOC -->
16
+
17
+
18
+ > Note: This documentation refers to the 1.0.0 pre-release version
19
+ > See [documentaton for v0.9.9](https://github.com/dannyben/madness/tree/v0.9.9#readme)
20
+ > if you are using an earlier version
21
+
22
+ ## Screenshots
23
+
24
+ [![Screenshots](assets/screenshots.gif)](assets/screenshots.gif)
37
25
 
38
26
  ## Install
39
27
 
@@ -56,11 +44,6 @@ $ brew gem install madness
56
44
  $ alias madness='docker run --rm -it -v $PWD:/docs -p 3000:3000 dannyben/madness'
57
45
  ```
58
46
 
59
- ## Design Intentions
60
-
61
- Madness was designed in order to provide easy browsing, viewing and
62
- searching for local, markdown based documentation directories.
63
-
64
47
  ## Feature Highlights
65
48
 
66
49
  - Easy to use.
@@ -69,16 +52,20 @@ searching for local, markdown based documentation directories.
69
52
  - Configure with a configuration file or command arguments.
70
53
  - Fully customizable theme.
71
54
  - Automatic generation of navigation sidebar.
72
- - Automatic generation of Table of Contents (site-wide and inline).
73
- - Can optionally show additional file types in the navigation menu (e.g. PDF files).
55
+ - Automatic generation of Table of Contents (site-wide and per page).
56
+ - Can optionally show additional file types in the navigation menu (e.g. PDF
57
+ files).
74
58
  - Optional support for `[[Short Link]]` syntax.
59
+ - Optional basic authentication.
60
+ - Support for extended markdown syntax, such as footnotes and syntax
61
+ highlighting.
75
62
 
76
63
  ## Usage
77
64
 
78
65
  Go to any directory that contains markdown files and run:
79
66
 
80
67
  ```shell
81
- $ madness
68
+ $ madness server
82
69
  ```
83
70
 
84
71
  And open <http://localhost:3000> in your browser.
@@ -93,14 +80,14 @@ $ madness --help
93
80
 
94
81
  Madness expects to be executed in a documentation directory.
95
82
 
96
- A documentation directory contains only markdown files (`*.md`) and
97
- sub directories that contain more markdown files.
83
+ A documentation directory contains only markdown files (`*.md`) and sub
84
+ directories that contain more markdown files.
98
85
 
99
- The server will consider the file `index.md` or `README.md` in any directory
100
- as the main file describing this directory, where `index.md` has priority.
86
+ The server will consider the file `index.md` or `README.md` in any directory as
87
+ the main file describing this directory, where `index.md` has priority.
101
88
 
102
- The navigation sidebar will show all the sub directories and files in
103
- the same directory as the viewed file.
89
+ The navigation sidebar will show all the sub directories and files in the same
90
+ directory as the viewed file.
104
91
 
105
92
  Example structure:
106
93
 
@@ -119,9 +106,17 @@ Example structure:
119
106
 
120
107
  ## Configuration File
121
108
 
122
- All the command line arguments can also be configured through a
123
- configuration file. Create a file named `.madness.yml` in your
124
- documentation directory, and modify any of the settings below.
109
+ Madness uses sensible defaults, so therefore can be executed without configuring
110
+ anything. Configuration is mostly done by having a file named `.madness.yml` in
111
+ your documentation directory.
112
+
113
+ For convenience, you can generate a template config file by running:
114
+
115
+ ```shell
116
+ $ madness config new
117
+ ```
118
+
119
+ which will generate this file, with all the default options:
125
120
 
126
121
  ```yaml
127
122
  # .madness.yml
@@ -144,12 +139,14 @@ auto_h1: true
144
139
  # append navigation to directory READMEs
145
140
  auto_nav: true
146
141
 
142
+ # replace <!-- TOC --> in any file with its internal table of contents
143
+ # set to true to enable it with the default '## Table of Contents' caption,
144
+ # or set to any string that will be inserted before it as a caption.
145
+ auto_toc: true
146
+
147
147
  # enable syntax highlighter for code snippets
148
148
  highlighter: true
149
149
 
150
- # enable line numbers for code snippets
151
- line_numbers: true
152
-
153
150
  # enable the copy to clipboard icon for code snippets
154
151
  copy_code: true
155
152
 
@@ -172,7 +169,7 @@ open: false
172
169
  auth: false
173
170
 
174
171
  # if auth is enabled, specify auth realm name
175
- auth_zone: Madness
172
+ auth_zone: Restricted Documentation
176
173
 
177
174
  # show files with these extensions in the navigation and search, for example:
178
175
  # expose_extensions: pdf,docx,xlsx,txt
@@ -183,17 +180,13 @@ expose_extensions: ~
183
180
  exclude: ['^[a-z_\-0-9]+$']
184
181
  ```
185
182
 
186
- For convenience, you can generate a template config file by running:
187
-
188
- ```shell
189
- $ madness create config
190
- ```
183
+ ## Features
191
184
 
192
- ## Search
185
+ ### Search
193
186
 
194
187
  Madness comes with a full text search page.
195
188
 
196
- ## Images and Static Files
189
+ ### Images and Static Files
197
190
 
198
191
  You can put images and other asset files anywhere in your documentation
199
192
  folder.
@@ -216,33 +209,38 @@ the path relative to the homepage:
216
209
  ![alt text](/images/nice-picture.png)
217
210
  ```
218
211
 
219
- ## Automatic H1
212
+ ### Automatic H1
220
213
 
221
214
  If your markdown document does not start with a level 1 heading, it
222
215
  will be automatically added based on the file name.
223
216
 
224
- ## Shortlinks
217
+ ### Shortlinks
225
218
 
226
219
  When the `shortlinks` option is enabled, you may use a shorthand syntax for
227
220
  specifying internal links, where `[[Anything]]` will be converted to
228
221
  `[Anything](Anything)`, which will then be rendered as an internal link to a
229
222
  file or a directory in the same directory as the file itself.
230
223
 
231
- ## Table of Contents Generation
224
+ ### Table of Contents Generation
232
225
 
233
- ### Site-wide
226
+ #### Site-wide
234
227
 
235
228
  To generate a Table of Contents file for the entire site (for the directories
236
229
  and files), run `madness --toc FILENAME`
237
230
 
238
- ### Inline
231
+ #### In-page
239
232
 
240
233
  If you have long markdown documents, and you wish to add an inline Table of
241
234
  Contents for them, simply add an HTML comment `<!-- TOC -->` where you want
242
235
  the Table of Contents to be generated. The inserted list will only consider
243
236
  H2 and H3 headings.
244
237
 
245
- ## Hidden Directories
238
+ Note that for this feature to work, your markdown document must use the #-based
239
+ heading syntax.
240
+
241
+ The 'Table of Contents' heading can be customized in the configuration file.
242
+
243
+ ### Hidden Directories
246
244
 
247
245
  Directories that are made only of lowercase letters, underscoes, dash and/or
248
246
  numbers (`/^[a-z_\-0-9]+$/`) will not be displayed in the navigation. In
@@ -262,7 +260,7 @@ exclude: [assets, public]
262
260
  exclude: ['^public$', 'assets']
263
261
  ```
264
262
 
265
- ## Controlling Sort Order
263
+ ### Controlling Sort Order
266
264
 
267
265
  To control the sort order of the automatically generated navigation elements,
268
266
  simply prefix your files and directories with digits followed by a dot and a
@@ -275,7 +273,7 @@ will be omitted when they are displayed.
275
273
  └── 2. Another file or folder
276
274
  ```
277
275
 
278
- ## Displaying Additional File Types
276
+ ### Displaying Additional File Types
279
277
 
280
278
  If you wish the navigation and search features to also show other documents
281
279
  and files (for example, PDF files), you may configure the `expose_extensions`
@@ -288,7 +286,7 @@ expose_extensions: pdf,docx,xlsx,txt
288
286
 
289
287
  The default value of this option is `null` (or `~`, which is `null` in YAML).
290
288
 
291
- ## Basic Authentication
289
+ ### Basic Authentication
292
290
 
293
291
  To add basic authentication, use the `--auth user:password` command line argument or the equivalent `auth` configuration option.
294
292
 
@@ -313,7 +311,7 @@ Madness comes with a command that copies the default theme to a folder of
313
311
  your choice, where you can customize it to your taste. Run:
314
312
 
315
313
  ```shell
316
- $ madness create theme my_theme
314
+ $ madness theme full my_theme
317
315
  ```
318
316
 
319
317
  Where `my_theme` is the folder that will be created.
@@ -322,7 +320,7 @@ To use the created theme, simply run Madness with the `--theme my_theme`
322
320
  option.
323
321
 
324
322
  ```shell
325
- $ madness --theme my_theme
323
+ $ madness server --theme my_theme
326
324
  ```
327
325
 
328
326
  Note that the generated theme contains the SCSS files in the `styles`
@@ -336,14 +334,15 @@ any tool to do so, or if you do not have a preference, use
336
334
 
337
335
  ### Option 2: Change CSS only
338
336
 
339
- If you are looking to implement a smaller CSS change, follow these steps:
337
+ If you are looking to implement a smaller CSS change, run:
338
+
339
+ ```shell
340
+ $ madness theme css
341
+ ```
340
342
 
341
- - Create a directory named `css` in your root documentation directory.
342
- - Copy the [main.css][css] file to it.
343
- - Update it as you see fit.
343
+ This will create the file `css/main.css` in the current directory. Update the
344
+ file as you see fit.
344
345
 
345
- Note that this functionality is not guaranteed to stay as is in future
346
- versions of madness.
347
346
 
348
347
  ## Docker Image
349
348
 
@@ -353,7 +352,7 @@ This command will start the server on localhost:3000, with the current
353
352
  directory as the markdown documentation folder
354
353
 
355
354
  ```shell
356
- $ docker run --rm -it -v $PWD:/docs -p 3000:3000 dannyben/madness
355
+ $ docker run --rm -it -v $PWD:/docs -p 3000:3000 dannyben/madness server
357
356
  ```
358
357
 
359
358
  You may create an alias for convenience:
@@ -374,7 +373,6 @@ For more information about the docker image, see:
374
373
 
375
374
  [dockerhub]: https://hub.docker.com/r/dannyben/madness/
376
375
  [dockerfile]: https://github.com/DannyBen/docker-madness
377
- [css]: app/public/css/main.css
378
- [app]: app
376
+ [css]: https://github.com/DannyBen/madness/blob/master/app/public/css/main.css
379
377
  [sasstool]: https://github.com/DannyBen/sasstool
380
378