UNPKG

19.8 kBMarkdownView Raw
1[![NPM](https://nodei.co/npm/jingo.png?compact=true)](https://npmjs.org/package/jingo)
2
3[ ![Codeship Status for claudioc/jingo](https://www.codeship.io/projects/4c413870-353e-0132-115c-220292a78f73/status)](https://www.codeship.io/projects/40997)
4
5JINGO
6=====
7
8A **git based** _wiki engine_ written for **node.js**, with a decent design, a search capability and a good typography.
9
10![Screenshot](https://dl.dropboxusercontent.com/u/152161/jingo/ss1.png)
11
12<!-- toc -->
13
14Table of contents
15-----------------
16
17 * [Introduction](#introduction)
18 * [Features](#features)
19 * [Installation](#installation)
20 * [Authentication and Authorization](#authentication-and-authorization)
21 * [Common problems](#common-problems)
22 * [Known limitations](#known-limitations)
23 * [Customization](#customization)
24 * [Editing](#editing)
25 * [Configuration options reference](#configuration-options-reference)
26
27<!-- toc stop -->
28
29Introduction
30-------------
31
32The aim of this wiki engine is to provide an easy way to create a centralized documentation area for people used to work with **git** and **markdown**. It should fit well into a development team without the burden to have to learn a complex and usually overkill application.
33
34Jingo is very much inspired by (and format-compatible with) the github own wiki system [Gollum](https://github.com/gollum/gollum), but it tries to be more a stand-alone and complete system than Gollum is.
35
36Think of jingo as "the github wiki, without github but with more features". "Jingo" means "Jingo is not Gollum" for more than one reason.
37
38There is a demo server running at http://jingo.cica.li:6067/wiki/home
39
40![Screenshot](https://dl.dropboxusercontent.com/u/152161/jingo/ss2.png)
41
42Features
43--------
44
45- No database: it uses a git repository as the document archive
46- No user management: authentication is provided via a 3rd party provider or a simple, one-user login
47- Markdown for everything, [github flavored](http://github.github.com/github-flavored-markdown/)
48- Uses [Codemirror](http://codemirror.net/) or [Markitup](http://markitup.jaysalvat.com/home/) as the markup editor, with a nice (ajax) preview (see the `features` key in the config file)
49- Provides a "distraction free", almost full screen editing mode
50- Compatible with a wiki created with the [Gollum](https://github.com/github/gollum) wiki
51- Revision history for all the pages
52- Show differences between document revisions
53- Paginated list of all the pages, with a quick way to find changes between revisions
54- Search through the content _and_ the page names
55- Layout accepts custom sidebar and footer
56- Gravatar support
57- Can include IFRAMEs in the document (es: embed a Google Drive document)
58- Can use custom CSS and JavaScript scripts
59- White list for authorization on page reading and writing
60- Detects unwritten pages (which will appear in red)
61- Automatically push to a remote
62- Mobile friendly (based on Bootstrap 3.x)
63- Quite configurable, but also works out of the box
64
65For code syntax highlighting, Jingo uses the `node-syntaxhighlighter` module. For the list of supported languages, please refer to [this page](https://github.com/thlorenz/node-syntaxhighlighter/tree/master/lib/scripts).
66
67![Screenshot](https://dl.dropboxusercontent.com/u/152161/jingo/ss3.png)
68
69Installation
70------------
71
72`npm install jingo` or download/clone the whole thing and run `npm install`.
73
74Note: if you already have Jingo installed, please also run `npm prune` (some modules can be stale and need to be removed).
75
76Jingo needs a config file and to create a sample config file, just run `jingo -s`, redirect the output on a file and then edit it (`jingo -s > config.yaml`). The config file contains all the available configuration options. Be sure to provide a valid server hostname (like wiki.mycompany.com) if you use a 3rd party provider for authentication (like Google or GitHub). It is needed for them to be able to get back to you.
77
78This document contains also [the reference](#configuration-options-reference) for all the possible options.
79
80If you define a `remote` to push to, then Jingo will automatically issue a push to that remote every `pushInterval` seconds. To declare a `remote` for Jingo to use, you'll need to identify the name of your local remote. The following example shows how a local remote is typically defined:
81
82`git remote add origin https://github.com/joeuser/jingorepo.git'`
83
84Based on that example, you would update config.yaml with the remote name "origin" as follows:
85
86`remote: "origin"`
87
88You can also use the `git remote` command to get the name of your remote.
89
90You can also specify a branch using the syntax "remotename branchname". If you don't specify a branch, Jingo will use `master`. Please note that before the `push`, a `pull` will also be issued (at the moment Jingo will not try to resolve conflicts, though).
91
92The basic command to run the wiki will then be
93
94`jingo -c /path/to/config.yaml`
95
96Before running jingo you need to initialise its git repository somewhere (`git init` is enough). Additionally the user running the process needs to have `git config --global user.name` and `git config --global user.email` configured. Else your document's repo will get scrambled and you have to reinitialize it again (`rm -rf .git && git init`).
97
98If you define a remote to push to, be sure that the user who'll push has the right to do so. This means you have to configure the remote via the `git://` URI that uses ssh authentication to push and have [created and published the process user's ssh public key](https://help.github.com/articles/generating-ssh-keys/) to the remote.
99
100If your documents reside in subdirectory of your repository, you need to specify its name using the `docSubdir` configuration option. The `repository` path _must_ be an absolute path pointing to the root of the repository.
101
102If you want your wiki server to only listen to your `localhost`, set the configuration key `localOnly` to true.
103
104![Screenshot](https://dl.dropboxusercontent.com/u/152161/jingo/ss4.png)
105
106Authentication and Authorization
107--------------------------------
108
109You can enable the following strategies: _Google logins (OAuth2)_, _GitHub logins (OAuth2)_ or a simple, locally verified username/password credentials match (called "local").
110
111The _Google Login_ and the _GitHub login_ uses OAuth 2 and that means that on a fresh installation you need to get a `client id` and a `client secret` from Google or GitHub and put those informations in the configuration file.
112
113For Google, follow these instructions (you need to be logged in in Google):
114
115* Open the [Google developer console](https://code.google.com/apis/console/)
116* Create a new project (you can leave the _Project id_ as it is). This will take a little while
117* Open the _Consent screen_ page and fill in the details (particularly, the _product name_)
118* Now open _APIs & auth_ => _Credentials_ and click on _Create new client id_
119* Here you need to specify the base URL of your jingo installation. Google will fill in automatically the other field
120 with a `/oauth2callback` URL, which is fine
121* Now you need to copy the `Client ID` and `Client secret` in your jingo config file in the proper places
122
123For GitHub, follow these instructions (you need to be logged in in GitHub):
124
125* Register a new application [here](https://github.com/settings/applications/new)
126* Enter whatever `Application name` you want
127* Enter your installation URL (localhost is OK, for example "http://localhost:6767/")
128* Enter <your installation URL>/auth/github/callback as the `Authorization callback URL`
129* Press the `Register application` button
130* In the following page, on the top right corner, take note of the values for `Client ID` and `Client Secret`
131* Now you need to copy the `Client ID` and `Client secret` in your jingo config file in the proper places
132
133The _local_ method uses an array of `username`, `passwordHash` and optionally an `email`. The password is hashed using a _non salted_ SHA-1 algorithm, which makes this method not the safest in the world but at least you don't have a clear text password in the config file. To generate the hash, use the `--hash-string` program option: once you get the hash, copy it in the config file.
134
135You can enable all the authentications options at the same time. The `local` is disabled by default.
136
137The _authorization_ section of the config file has two keys: `anonRead` and `validMatches`. If the `anonRead` is true, then anyone who can access the wiki can read anything.
138
139If anonRead is false you need to authenticate also for reading and then the email of the user _must_ match at least one of the regular expressions provided via validMatches, which is a comma separated list. There is no "anonWrite", though. To edit a page the user must be authenticated.
140
141The authentication is mandatory to edit pages from the web interface, but jingo works on a git repository; that means that you could skip the authentication altogether and edit pages with your editor and push to the remote that jingo is serving.
142
143Known limitations
144-----------------
145
146- The authentication is mandatory (no anonymous writing allowed). See also issue #4
147- The repository is "flat" (no directories or namespaces)
148- Authorization is only based on a regexp'ed white list with matches on the user email address
149- There is one authorization level only (no "administrators" and "editors")
150- At the moment there is no "restore previous revision", just a revision browser
151- No scheduled pull or fetch from the remote is provided (because handling conflicts would be a bit too... _interesting_)
152
153Please note that at the moment it is quite "risky" to have someone else, other than jingo itself, have write access to the remote / branch jingo is pushing to. The push operation is supposed to always be successfull and there is no pull or fetch. You can of course manage to handle pull requests yourself.
154
155Customization
156-------------
157
158You can customize jingo in four different ways:
159
160- add a left sidebar to every page: just add a file named `_sidebar.md` containing the markdown you want to display to the repository. You can edit or create the sidebar from Jingo itself, visiting `/wiki/_sidebar` (note that the title of the page in this case is useless)
161- add a footer to every page: the page you need to create is `_footer.md` and the same rules for the sidebar apply
162- add a custom CSS file, included in every page as the last file. The default name of the file is `_style.css` and it must reside in the document directory (but can stay out of the repo). It is not possible to edit the file from jingo itself
163- add a custom JavaScript file, included in every page as the last JavaScript file. The default name of the file is `_script.js` and it must reside in the document directory (but can stay out of the repo). It is not possible to edit the file from jingo itself
164
165All these names are customizable via the `customizations` option in the config file (see [the reference](#configuration-options-reference)).
166
167Once read, all those files are cached (thus, not re-read for every page load, but kept in memory). This means that for every modification in _style.css and _script.js you need to restart the server (sorry, working on that).
168
169This is not true for the footer and the sidebar but ONLY IF you edit those pages from jingo (which in that case will clear the cache by itself).
170
171Editing
172-------
173
174To link to another Jingo wiki page, use the Jingo Page Link Tag.
175
176 [[Jingo Works]]
177
178The above tag will create a link to the corresponding page file named `jingo-works.md`. The conversion is as follows:
179
180 1. Replace any spaces (U+0020) with dashes (U+002D)
181 2. Replace any slashes (U+002F) with dashes (U+002D)
182
183If you'd like the link text to be something that doesn't map directly to the page name, you can specify the actual page name after a pipe:
184
185 [[How Jingo works|Jingo Works]]
186
187The above tag will link to `Jingo-Works.md` using "How Jingo Works" as the link text.
188
189Images
190------
191
192If you put images into the repository, Jingo will be able to serve them. You can enable Jingo to serve even other file types from the document directory: you need to change the `staticWhitelist` configuration option.
193
194Configuration options reference
195-------------------------------
196
197#### application.title
198
199 This will be showed on the upper left corner of all the pages, in the main toolbar
200
201#### application.repository
202
203 Absolute path for your documents repository (mandatory).
204
205#### application.docSubdir
206
207 If your documents reside inside a directory of the repository, specify its name here.
208
209#### application.remote
210
211 This is the name of the remote you want to push/pull to/from (optional). You can also specify a specific branch using the syntax “remotename branchname”. If you don’t specify a branch, Jingo will use master.
212
213#### application.pushInterval
214
215 Jingo will try to push to the remote (if present) every XX seconds (defaults to 30)
216
217#### application.secret
218
219 Just provide a string to be used to crypt the session cookie
220
221#### application.git
222
223 You can specify a different git binary, if you use more than one in your system
224
225#### application.skipGitCheck
226
227 Jingo will refuse to start if it founds a version of git which is known to be problematic. You can still force it to start anyway, providing `true` as the value for this option
228
229#### application.loggingMode
230
231 Specifies how verbose the http logging should be. Accepts numeric values: `0` for no logging at all, `1` for the a combined log and `2` for a coincise, coloured log (good for development). Default is `1`.
232
233#### application.pedanticMarkdown
234
235 Boolean, defaults to `true` (was `false` in jingo < 1.1.0)
236
237 The markdown module we use (Marked) tries to overcome some "obscure" problems with the original Perl markdown parser by default. These produces some problems when rendering HTML embedded in a markdown document (see also issue https://github.com/claudioc/jingo/issues/48. By default we now want to use the original parser and not the modified one (pedantic: true).
238
239 With this option you can revert this decision if for some reason your documents are not rendered how you like.
240
241####application.gfmBreaks
242
243 Enable [GFM line breaks](https://help.github.com/articles/github-flavored-markdown#newlines) (defaults to `true`).
244
245####authentication.staticWhitelist
246
247 This is to enable jingo to serve any kind of static file (like images) from the repository. By default, Jingo will serve `*.md` files and `*.jpg, *.png, *.gif`. Provide the values as a comma separated list of regular expressions.
248
249#### authentication.google.enabled
250
251 Boolean, defaults to `true`
252
253#### authentication.google.clientId
254#### authentication.google.clientSecret
255
256 Values required for Google OAuth2 authentication. Refer to a previous section of this document on how to set them up.
257
258#### authentication.github.enabled
259
260 Boolean, defaults to `false`
261
262#### authentication.github.clientId
263#### authentication.github.clientSecret
264
265 Values required for GitHub OAuth2 authentication. Refer to a previous section of this document on how to set them up.
266
267#### authentication.local.enabled
268
269 Boolean, defaults to `false`
270
271 The Local setup allows you to specify an array of username/password/email elements that
272 will have access to the Wiki. All the accounts must resides in the configuration `authentication.local.accounts` array
273
274#### authentication.local.[accounts].username
275
276 Provide any username you like, as a string
277
278#### authentication.local.[accounts].passwordHash
279
280 Use an hash of your password. Create the hash with `jingo -# yourpassword`
281
282#### authentication.local.[accounts].email
283
284 If you want to use Gravatar, provide your gravatar email here.
285
286#### authentication.alone.enabled
287
288 Boolean, defaults to `false`
289 _The Alone authentication option is deprecated in favor of the Local one_
290
291#### authentication.alone.username
292
293 Provide any username you like, as a string
294 _The Alone authentication option is deprecated in favor of the Local one_
295
296#### authentication.alone.passwordHash
297
298 Use an hash of your password. Create the hash with `jingo -# yourpassword`
299 _The Alone authentication option is deprecated in favor of the Local one_
300
301#### authentication.alone.email
302
303 If you want to use Gravatar, provide your gravatar email here.
304 _The Alone authentication option is deprecated in favor of the Local one_
305
306#### features.markitup
307
308 Boolean, whether to enable Markitup or not (default false)
309
310#### features.codemirror
311
312 Boolean, whether to enable Codemirror or not (default true)
313
314 Please note that you cannot enable both editors at the same time.
315
316#### server.hostname
317
318 This is the hostname used to build the URL for your wiki pages. The reason for these options to exist is due to the need for the OAuth2 authentication to work (it needs an endpoint to get back to)
319
320#### server.port
321
322 Jingo will listen on this port
323
324#### server.localOnly
325
326 Set this to `true` if you want to accept connection only _from_ localhost (default false)
327
328#### server.baseUrl
329
330 Not used anymore (built with "//" + hostname + ":" + port)
331
332#### authorization.anonRead
333
334 Boolean to enable/disable the anonymous access to the wiki content (default true)
335
336#### authorization.validMatches
337
338 This is a regular expression which will be used against the user email account to be able to access the wiki. By default all google powered emails are OK, but you can for example set a filter so that only the hostname from your company will be allowed access.
339
340#### authorization.emptyEmailMatches
341
342 If the endpoint doesn't provide the email address for the user, allow empty emails to authenticate anyway (defaults to true)
343
344#### pages.index
345
346 Defines the page name for the index of the wiki (default is "Home")
347
348#### pages.title.fromFilename
349
350 If this is true, the title of each page will be derived from the document's filename. This is how Gollum works and from Jingo 1.0 this is now the default (default true). An important consequence of this behavior is that now Jingo is able _to rename_ documents (according to the new name it will be eventually given to), while previously it was impossible.
351
352#### pages.title.fromContent
353
354 If this is true, the title of the document will be part of the document itself (the very first line). This is the default behavior of Jingo < 1.0 and the default is now false. If you have an old installation of Jingo, please set this value to true and `fromFilename` to false.
355
356#### pages.title.asciiOnly
357
358 If this is set to true, Jingo will convert any non-Ascii character present in the title of the document to an ASCII equivalent (using transliteration), when creating the filename of the document. Default was true for Jingo < 1.0 while for Jingo >= 1.0 the default is false
359
360#### pages.title.lowercase
361
362 If this is set to true, Jingo will lowercase any character of the title when creating the filename. Default was true for Jingo < 1.0 while for Jingo >= 1.0 the default is false
363
364#### pages.title.itemsPerPage
365
366 This defines how many page item to show in the "list all page" page. Keep this value as low as possible (default to 10) for performance reasons.
367
368#### customizations.sidebar
369
370 Defines the name for the _sidebar_ component. Defaults to `_sidebar.md`. Please note that if you need to use a wiki coming from Github, this name should be set to `_Sidebar`
371
372#### customizations.footer
373
374 Defines the name for the _footer_ component. Defaults to `_footer.md`. Please note that if you need to use a wiki coming from Github, this name should be set to '_Footer'
375
376#### customizations.style
377
378 Defines the name for the customized _style_ CSS component. Defaults to `_style.css`.
379
380#### customizations.script
381
382 Defines the name for the customized _script_ JavaScript component. Defaults to `_script.js`.