2013-06-10 17:54:41 +00:00
Developer guide
===============
2013-06-12 22:58:58 +00:00
----------
2013-05-29 21:45:40 +00:00
Architecture
2013-06-10 17:54:41 +00:00
------------
![Architecture diagram][1]
2013-06-11 23:03:58 +00:00
StackEdit uses [RequireJS][2] for asynchronous module definition ([AMD][3]).
2013-06-10 17:54:41 +00:00
2013-06-12 22:58:58 +00:00
----------
2013-06-11 23:03:58 +00:00
### core
2013-06-10 17:54:41 +00:00
2013-06-11 23:03:58 +00:00
The `core` module is responsible for:
2013-06-10 17:54:41 +00:00
2013-06-11 23:03:58 +00:00
- creating the layout (using [UI Layout][4])
- creating the editor (using [PageDown][5])
- Loading/saving the settings
- detecting the offline status
2013-06-12 22:58:58 +00:00
----------
2013-06-11 23:03:58 +00:00
### fileMgr
The `fileMgr` module is responsible for:
- creating/deleting local files
- switching from one file to another
- setting/removing file's sync/publish location
2013-06-12 22:58:58 +00:00
----------
2013-06-11 23:03:58 +00:00
### synchronizer
2013-06-10 17:54:41 +00:00
The `synchronizer` module is responsible for:
- creating a new local file from a sync location (import)
- creating a new sync location from a local file (export)
- running 2 ways synchronization (upload and download) for all sync locations
2013-06-12 22:58:58 +00:00
----------
2013-06-11 23:03:58 +00:00
### publisher
2013-06-10 17:54:41 +00:00
The `publisher` module is responsible for:
- creating new publish locations
- updating existing publish locations
2013-06-11 23:03:58 +00:00
#### publisher's providers
2013-06-16 17:28:51 +00:00
A [`provider`][6] module can be associated with the `publisher` module if it implements the following functions:
- `newPublishAttributes()` : returns a new [`publishAttributes`][7] object in order to create a new publish location
2013-06-11 23:03:58 +00:00
- `publish()` : performs publishing of one publish location
2013-06-10 17:54:41 +00:00
#### publishAttributes
2013-06-11 23:03:58 +00:00
A `publishAttributes` object is an object that describes a publish location. Attributes list differs from one provider to another except for the following attributes:
- `publishIndex` : the unique index of the publish location
2013-06-16 17:28:51 +00:00
- `provider` : the [`provider`][6] module that handles the publish location
2013-06-11 23:03:58 +00:00
- `format` : the publishing format for the publish location. It can be:
- `markdown` for Markdown format
- `html` for HTML format
- `template` for template format
2013-06-16 17:28:51 +00:00
----------
2013-06-11 23:03:58 +00:00
2013-06-10 17:54:41 +00:00
2013-06-16 17:28:51 +00:00
### provider
2013-06-10 17:54:41 +00:00
2013-05-29 21:45:40 +00:00
2013-05-29 22:10:25 +00:00
2013-05-29 20:01:33 +00:00
> Written with [StackEdit](http://benweet.github.io/stackedit/).
2013-06-10 17:54:41 +00:00
[1]: http://benweet.github.io/stackedit/doc/img/architecture.png "Architecture diagram"
2013-06-11 23:03:58 +00:00
[2]: http://requirejs.org/ "RequireJS"
[3]: http://en.wikipedia.org/wiki/Asynchronous_module_definition "Asynchronous module definition"
[4]: http://layout.jquery-dev.net/ "UI Layout"
[5]: https://code.google.com/p/pagedown/ "PageDown"
2013-06-16 17:28:51 +00:00
[6]: #provider
[7]: #publishattributes