comodojo / dispatcher.servicebundle.gitdoc
Services used together with dispatcher.plugin.gitdoc to generate documentation with comodojo/dispatcher.framework
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:dispatcher-service-bundle
Requires
- comodojo/dispatcher.plugin.gitdoc: dev-master
- comodojo/dispatcher.template.bootstrap: 1.0.*
- comodojo/httprequest: 1.0.*
- comodojo/zip: 1.0.*
- dompdf/dompdf: 0.6.*
- erusev/parsedown: 1.1.*
This package is auto-updated.
Last update: 2022-02-01 12:37:58 UTC
README
Gitdoc is a comodojo/dispatcher framework service+plugin bundle used to publish the comodojo::docs website.
This plugin is designed to manage different projects' documentation, mantained as markdown files on multiple GitHub repositories.
Build and presentation processes are triggered via GitHub push/tag events; on each (supported) event message, whole docs archive is downloaded from GitHub and parsed to compose static html.
Installation
-
Install comodojo/dispatcher via composer.
-
Require comodojo/dispatcher.servicebundle.gitdoc package:
commposer require comodojo/dispatcher.servicebundle.gitdoc dev-master
-
Ensure that
downloads
anddocs
folders inside dispatcher project are readable/writeable by apache user and add following two lines todispatcher-config.php
:define('DISPATCHER_DOWNLOAD_FOLDER', DISPATCHER_REAL_PATH."downloads/"); define('DISPATCHER_DOC_FOLDER', DISPATCHER_REAL_PATH."docs/");
-
Create
gitdoc.json
file underconfig
directory; file content should follow this schema:{ "sitename": "Foo docs", "description": "Foo Documentation", "showHeader": true, "showFooter": true, "links": { "External link": "http://www.example.org" }, "projects": [ { "name": "bar", "description": "the bar project", "docId": "bar", "hash": "myReallySecureGitHubWebhookHash" } ] }
- showHeader and showFooter are boolean values: if true, header and footer information sections will be displayed
- each link in links object will add an external href to the top/right menu item
- each project in project object will declare a new documentation section:
- name: docsite name
- description
- docId (see next section to understand how to use it)
- hash (optional): secret hook hash
-
Setup a WebHook on GitHub repository:
- Payload URL:
http://your.documentation.site/receiver/[docId - as in previous section]/
- Content type:
application/x-www-form-urlencoded
- Secret:
hash
parameter as in previous section - Events: select Create, Delete, Push
- Payload URL:
Your docsite is now ready to receive updates.
Repository summary
Repository should contain markdown files, one for each chapter, plus one summary.json
file like this:
{
"title": "Foo docs",
"subtitle": "My fantastic project",
"chapters": {
"First chapter": "first.md",
"Second chapter": "second.md",
"Foo chapter": "foo.md",
"Conclusions": "foo.conclusions.md"
}
}
In chapters
object, keys will become chapters name added directly in html.
h1 (#) and h2 (##) headings will be linked to left-sidebar srollspy.
Usage
Just navigate to http://your.documentation.site/docId/
to show your documentation.
Dispatcher will inject routes automatically, one for each project that received at least 1 update.
Because of this behaviour, it is strongly suggested to not add other rules/services into dispatcher instance used to publish docs.