2016-01-19 11:21:45 -05:00
HackMD
2015-05-04 03:53:29 -04:00
===
2015-08-15 00:15:42 -04:00
[![Join the chat at https://gitter.im/hackmdio/hackmd ](https://badges.gitter.im/Join%20Chat.svg )](https://gitter.im/hackmdio/hackmd?utm_source=badge& utm_medium=badge& utm_campaign=pr-badge& utm_content=badge)
2016-10-04 06:05:30 -04:00
HackMD lets you create realtime collaborative markdown notes on all platforms.
Inspired by Hackpad, with more focus on speed and flexibility.
2016-10-02 22:33:30 -04:00
Still in the early stage, feel free to fork or contribute to HackMD.
2015-05-04 03:53:29 -04:00
2016-10-02 22:33:30 -04:00
Thanks for using! :smile:
2015-05-15 00:58:13 -04:00
2016-04-20 06:03:55 -04:00
[docker-hackmd ](https://github.com/hackmdio/docker-hackmd )
---
2016-10-04 04:41:26 -04:00
2016-10-04 06:05:30 -04:00
Before you go too far, here is the great docker repo for HackMD.
2016-10-02 22:33:30 -04:00
With docker, you can deploy a server in minutes without any downtime.
2016-04-20 06:03:55 -04:00
[migration-to-0.4.0 ](https://github.com/hackmdio/migration-to-0.4.0 )
---
2016-10-04 04:41:26 -04:00
2016-10-04 06:05:30 -04:00
We've dropped MongoDB after version 0.4.0.
So here is the migration tool for you to transfer the old DB data to the new DB.
2016-04-20 06:03:55 -04:00
This tool is also used for official service.
2016-01-29 14:28:45 -05:00
Browsers Requirement
---
2016-10-04 04:41:26 -04:00
2016-01-29 14:28:45 -05:00
- Chrome >= 45, Chrome for Android >= 47
- Safari >= 9, iOS Safari >= 8.4
- Firefox >= 44
- IE >= 9, Edge >= 12
- Opera >= 34, Opera Mini not supported
- Android Browser >= 4.4
2015-09-27 02:45:21 -04:00
Prerequisite
2015-07-11 00:52:04 -04:00
---
2016-10-04 04:41:26 -04:00
2016-06-27 21:38:31 -04:00
- Node.js 4.x or up (test up to 6.2.2)
2016-04-20 06:03:55 -04:00
- Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL)
2015-12-15 18:53:56 -05:00
- npm and bower
2015-07-11 00:52:04 -04:00
2015-09-27 02:45:21 -04:00
Get started
2015-06-01 06:04:25 -04:00
---
2016-10-04 04:41:26 -04:00
2015-09-27 02:45:21 -04:00
1. Download a release and unzip or clone into a directory
2016-10-05 02:17:32 -04:00
2. Enter the directory and type `bin/setup` , which will install npm/bower dependencies and create configs. The setup script is written in Bash, you would need bash as a prerequisite.
2016-10-02 22:33:30 -04:00
3. Setup the configs, see more below
4. Setup environment variables which will overwrite the configs
2016-04-20 06:03:55 -04:00
5. Run the server as you like (node, forever, pm2)
2015-06-01 06:04:25 -04:00
2016-06-14 10:57:54 -04:00
Upgrade guide
2016-06-01 12:13:01 -04:00
---
2016-10-04 04:41:26 -04:00
2016-06-14 15:30:19 -04:00
If you are upgrading HackMD from an older version, follow these steps:
2016-06-14 10:57:54 -04:00
2016-10-02 22:33:30 -04:00
1. Fully stop your old server first (important)
2. `git pull` or do whatever that updates the files
3. `npm install && bower install` to update dependencies
2016-10-04 04:41:26 -04:00
4. Modify the file named `.sequelizerc` , change the value of the variable `url` with your db connection string
2016-10-02 22:33:30 -04:00
For example: `postgres://username:password@localhost:5432/hackmd`
5. Run `node_modules/.bin/sequelize db:migrate` , this step will migrate your db to the latest schema
2016-06-14 15:21:54 -04:00
6. Start your whole new server!
2016-06-01 12:13:01 -04:00
2015-07-01 12:10:20 -04:00
Structure
---
2016-10-04 04:41:26 -04:00
```text
2015-07-01 12:10:20 -04:00
hackmd/
2016-10-04 04:41:26 -04:00
├── tmp/ --- temporary files
├── docs/ --- document files
├── lib/ --- server libraries
└── public/ --- client files
├── css/ --- css styles
├── js/ --- js scripts
├── vendor/ --- vendor includes
└── views/ --- view templates
2015-07-01 12:10:20 -04:00
```
2015-09-15 04:49:23 -04:00
Configuration files
2015-06-01 06:04:25 -04:00
---
2016-10-04 04:41:26 -04:00
2016-10-02 22:33:30 -04:00
There are some configs you need to change in the files below
2016-10-04 04:41:26 -04:00
2015-05-15 00:58:13 -04:00
```
2016-04-20 06:03:55 -04:00
./config.json --- for server settings
2016-02-16 23:08:44 -05:00
./public/js/common.js --- for client settings
2015-05-15 00:58:13 -04:00
```
2016-04-20 06:03:55 -04:00
Client settings `common.js`
2015-09-15 04:08:50 -04:00
---
2016-10-04 04:41:26 -04:00
2015-09-15 04:08:50 -04:00
| variables | example values | description |
| --------- | ------ | ----------- |
| debug | `true` or `false` | set debug mode, show more logs |
2016-02-16 23:08:44 -05:00
| domain | `localhost` | domain name |
| urlpath | `hackmd` | sub url path, like: `www.example.com/<urlpath>` |
2016-04-20 06:03:55 -04:00
Environment variables (will overwrite other server configs)
2015-09-15 04:08:50 -04:00
---
2016-10-04 04:41:26 -04:00
2015-09-15 04:08:50 -04:00
| variables | example values | description |
| --------- | ------ | ----------- |
2016-10-02 22:33:30 -04:00
| NODE_ENV | `production` or `development` | set current environment (will apply corresponding settings in the `config.json` ) |
2016-04-21 15:33:09 -04:00
| DOMAIN | `hackmd.io` | domain name |
| URL_PATH | `hackmd` | sub url path, like `www.example.com/<URL_PATH>` |
2016-04-20 06:03:55 -04:00
| PORT | `80` | web app port |
| DEBUG | `true` or `false` | set debug mode, show more logs |
Server settings `config.json`
2015-09-15 04:08:50 -04:00
---
2016-10-04 04:41:26 -04:00
2015-09-15 04:08:50 -04:00
| variables | example values | description |
| --------- | ------ | ----------- |
| debug | `true` or `false` | set debug mode, show more logs |
2016-04-20 06:03:55 -04:00
| domain | `localhost` | domain name |
| urlpath | `hackmd` | sub url path, like `www.example.com/<urlpath>` |
| port | `80` | web app port |
2015-09-15 04:08:50 -04:00
| alloworigin | `['localhost']` | domain name whitelist |
2016-04-20 06:03:55 -04:00
| usessl | `true` or `false` | set to use ssl server (if true will auto turn on `protocolusessl` ) |
| protocolusessl | `true` or `false` | set to use ssl protocol for resources path |
| urladdport | `true` or `false` | set to add port on callback url (port 80 or 443 won't applied) |
| usecdn | `true` or `false` | set to use CDN resources or not |
| db | `{ "dialect": "sqlite", "storage": "./db.hackmd.sqlite" }` | set the db configs, [see more here ](http://sequelize.readthedocs.org/en/latest/api/sequelize/ ) |
| sslkeypath | `./cert/client.key` | ssl key path (only need when you set usessl) |
| sslcertpath | `./cert/hackmd_io.crt` | ssl cert path (only need when you set usessl) |
| sslcapath | `['./cert/COMODORSAAddTrustCA.crt']` | ssl ca chain (only need when you set usessl) |
| dhparampath | `./cert/dhparam.pem` | ssl dhparam path (only need when you set usessl) |
| tmppath | `./tmp/` | temp directory path |
| defaultnotepath | `./public/default.md` | default note file path |
| docspath | `./public/docs` | docs directory path |
| indexpath | `./public/views/index.ejs` | index template file path |
| hackmdpath | `./public/views/hackmd.ejs` | hackmd template file path |
| errorpath | `./public/views/error.ejs` | error template file path |
| prettypath | `./public/views/pretty.ejs` | pretty template file path |
| slidepath | `./public/views/slide.hbs` | slide template file path |
2015-09-15 04:08:50 -04:00
| sessionname | `connect.sid` | cookie session name |
| sessionsecret | `secret` | cookie session secret |
| sessionlife | `14 * 24 * 60 * 60 * 1000` | cookie session life |
2016-04-20 06:03:55 -04:00
| staticcachetime | `1 * 24 * 60 * 60 * 1000` | static file cache time |
2015-09-15 04:08:50 -04:00
| heartbeatinterval | `5000` | socket.io heartbeat interval |
| heartbeattimeout | `10000` | socket.io heartbeat timeout |
| documentmaxlength | `100000` | note max length |
2016-03-14 23:30:43 -04:00
Third-party integration api key settings
---
2016-10-04 04:41:26 -04:00
2016-03-14 23:30:43 -04:00
| service | file path | description |
| ------- | --------- | ----------- |
2016-05-21 10:48:00 -04:00
| facebook, twitter, github, gitlab, dropbox, google | `config.json` | for signin |
2016-04-20 06:03:55 -04:00
| imgur | `config.json` | for image upload |
2016-05-15 09:51:35 -04:00
| google drive, dropbox | `public/js/common.js` | for export and import |
2016-04-23 06:58:24 -04:00
2016-07-05 11:16:02 -04:00
Third-party integration oauth callback urls
---
2016-10-04 04:41:26 -04:00
2016-07-05 11:16:02 -04:00
| service | callback url (after the server url) |
| ------- | --------- |
| facebook | `/auth/facebook/callback` |
| twitter | `/auth/twitter/callback` |
| github | `/auth/github/callback` |
| gitlab | `/auth/gitlab/callback` |
| dropbox | `/auth/dropbox/callback` |
| google | `/auth/google/callback` |
2015-09-15 04:49:23 -04:00
Operational Transformation
2015-06-01 06:04:25 -04:00
---
2016-10-04 04:41:26 -04:00
2016-10-04 06:05:30 -04:00
From 0.3.2, we started supporting operational transformation.
It makes concurrent editing safe and will not break up other users' operations.
Additionally, now can show other clients' selections.
2016-10-04 04:41:26 -04:00
See more at [http://operational-transformation.github.io/ ](http://operational-transformation.github.io/ )
2015-05-07 23:52:30 -04:00
2015-09-24 22:39:09 -04:00
**License under MIT.**