Update documentation

This commit is contained in:
Stéphane Goetz 2015-07-19 16:36:59 +02:00
parent c00dfac001
commit 3671214839
4 changed files with 280 additions and 199 deletions

View File

@ -16,6 +16,9 @@
* Supports Google Analytics and Piwik Analytics
* Optional code float layout
* Static Output Generation
* Internal documentation links
* Multiple Output Formats
* Extend Daux.io with Processors
## Demos
@ -27,7 +30,6 @@ This is a list of sites using Daux.io:
* [Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation](http://mun.ee)
* [ICADMIN: An admin panel powered by CodeIgniter.](http://istocode.com/shared/ic-admin/)
* [TrackJs](http://docs.trackjs.com) (uses a customized theme)
* [Sugoi](http://doc.sugoi.ventrux.com/)
* [wallabag](http://doc.wallabag.org/index)
Do you use Daux.io? Send me a pull request or open an [issue](https://github.com/justinwalsh/daux.io/issues) and I will add you to the list.
@ -36,6 +38,58 @@ Do you use Daux.io? Send me a pull request or open an [issue](https://github.com
Download this repository as a zip, and unpack. Copy the files to a web server that can run PHP 5.3 or greater. You can also run the documentation locally using Grunt.js, which is covered at the end of this readme.
## Generating a set of static files
These can be uploaded to a static site hosting service such as pages.github.com
Generating a complete set of pages, with navigation
```bash
./generate --destination=[Output Directory Relative Direction]
```
For more options, run
```bash
./generate --help
```
## Formats
Daux.io is extendable and comes by default with two export formats:
- Export to HTML
- Upload to your Atlassian Confluence server
## Feature Matrix
<table>
<tr>
<th>Feature</th><th>HTML</th><th>Confluence</th>
</tr>
<tr>
<td>Landing Pages</td><td></td><td>X</td>
</tr>
<tr>
<td>Index Pages</td><td></td><td></td>
</tr>
<tr>
<td>Internal Links</td><td></td><td></td>
</tr>
<tr>
<td>Code Highlight</td><td></td><td>√ (Using macros)</td>
</tr>
<tr>
<td>Live Mode</td><td></td><td>X</td>
</tr>
<tr>
<td>Ordering Pages</td><td></td><td>X (API Limitation)</td>
</tr>
<tr>
<td>Google / Piwik analytics</td><td></td><td>X</td>
</tr>
</table>
## Folders
By default, the generator will look for folders in the `docs` folder. Add your folders inside the `docs` folder. This project contains some example folders and files to get you started.
@ -69,7 +123,7 @@ You might also wish to stick certain links to the bottom of a page. You can do s
## Landing page
If you want to create a beautiful landing page for your project, simply create a `_index.md` file in the root of the `/docs` folder. This file will then be used to create a landing page. You can also add a tagline and image to this page using the config file like this:
If you want to create a beautiful landing page for your project, create a `_index.md` file in the root of the `/docs` folder. This file will then be used to create a landing page. You can also add a tagline and image to this page using the config file like this:
```json
{
@ -79,27 +133,28 @@ If you want to create a beautiful landing page for your project, simply create a
}
```
Note: The image can be a local or remote image. Use the convention `<base_url>` to refer to the root directory of the Daux instance.
Note: The image can be a local or remote image. By default, the path is relative to the root of the documentation
## Section landing page
## Section Index page
If you are interested in having a landing page for a subsection of your docs, all you need to do is add an `index.md` file to the folder. For example, `/docs/01_Examples` has a landing page for that section since there exists a `/docs/01_Examples/index.md` file. If you wish to have an landing page for a section sans the document format, use the name `_index.md`
By default, a folder will have no index page. if you wish to have one defined all you need to do is add an `index.md` file to the folder. For example, `/docs/01_Examples` has a landing page for that section since there exists a `/docs/01_Examples/index.md` file.
## Clean URLs
## Internal links
Daux provides native support for Clean URLs provided the webserver has its URL Rewrite module enabled. To enable the same, simply set the toggle in the `config.json` file in the `/docs` folder.
You can create links from a page to an other, the link is then resolved to the real page.
Creating a link to another page is done exactly like a normal markdown link. In the url part, start with `!` and set the absolute path to the file, omitting the numbering and file extension
A link to `01_Examples/05_Code_Highlighting.md` Would be written like this: `[Code Highlight Examples](!Examples/Code_Highlighting)`
The page generation will fail if a link is wrong.
```json
{
"clean_urls": true
}
```
## Configuration
To customize the look and feel of your documentation, you can create a `config.json` file in the of the `/docs` folder. The `config.json` file is a simple JSON object that you can use to change some of the basic settings of the documentation.
To customize the look and feel of your documentation, you can create a `config.json` file in the of the `/docs` folder. The `config.json` file is a JSON object that you can use to change some of the basic settings of the documentation.
### Title:
### Title
Change the title bar in the docs
```json
@ -108,106 +163,25 @@ Change the title bar in the docs
}
```
### Themes:
We have 4 built-in Bootstrap themes. To use one of the themes, just set the `theme` option to one of the following:
* daux-blue
* daux-green
* daux-navy
* daux-red
### Tagline
Change the tagline bar in the docs
```json
{
"theme": "daux-blue"
"tagline": "The Easiest Way To Document Your Project"
}
```
### Custom Theme:
To use a custom theme, just copy over the theme folder into the `themes` directory and set its value in the `theme` param in config.json
### Author
Change the documentation's author
```json
{
"theme": "new-theme",
"author": "Stéphane Goetz"
}
```
### Code Floating:
By default your code blocks will be floated to a column on the right side of your content. To disable this feature, set the `float` property to `false`.
```json
{
"float": false
}
```
### Toggling Code Blocks
Some users might wish to hide the code blocks & view just the documentation. By setting the `toggle_code` property to `true`, you can offer a toggle button on the page.
```json
{
"toggle_code": true
}
```
### GitHub Repo:
Add a 'Fork me on GitHub' ribbon.
```json
{
"repo": "justinwalsh/daux.io"
}
```
### Twitter:
Include twitter follow buttons in the sidebar.
```json
{
"twitter": ["justin_walsh", "todaymade"]
}
```
### Links:
Include custom links in the sidebar.
```json
{
"links": {
"GitHub Repo": "https://github.com/justinwalsh/daux.io",
"Help/Support/Bugs": "https://github.com/justinwalsh/daux.io/issues",
"Made by Todaymade": "http://todaymade.com"
}
}
```
### Google Analytics:
This will embed the google analytics tracking code.
```json
{
"google_analytics": "UA-XXXXXXXXX-XX"
}
```
### Piwik Analytics:
This will embed the piwik tracking code.
```json
{
"piwik_analytics": "my-url-for-piwik.com"
}
```
You can Also give a specific Piwik ID as well.
```json
{
"piwik_analytics_id": "43"
}
```
### Ignore:
### Ignore
Set custom files and entire folders to ignore within your `/docs` folder. For files make sure to include the file extension in the name. For both files and folders, names are case-sensitive.
```json
@ -219,25 +193,6 @@ Set custom files and entire folders to ignore within your `/docs` folder. For fi
}
```
### Breadcrumb titles
Daux.io provides the option to present page titles as breadcrumb navigation. You can *optionally* specify the separator used for breadcrumbs.
```json
{
"breadcrumbs": true,
"breadcrumb_separator" : " > "
}
```
### Date Modified
By default, daux.io will display the last modified time as reported by the system underneath the title for each document. To disable this, change the option in your config.json to false.
```json
{
"date_modified": false
}
```
### Timezone
If your server does not have a default timezone set in php.ini, it may return errors when it tries to generate the last modified date/time for docs. To fix these errors, specify a timezone in your config file. Valid options are available in the [PHP Manual](http://php.net/manual/en/timezones.php).
@ -278,43 +233,213 @@ Directory structure:
│ │ │ ├── 05_Code_Highlighting.md
```
## Running Remotely
### HTML Export Configuration
#### Themes
We have 4 built-in Bootstrap themes. To use one of the themes, just set the `theme` option to one of the following:
* daux-blue
* daux-green
* daux-navy
* daux-red
```json
{
"html": { "theme": "daux-blue" }
}
```
#### Custom Theme
To use a custom theme, just copy over the theme folder into the `themes` directory and set its value in the `theme` param in config.json
```json
{
"html": { "theme": "new-theme" }
}
```
#### Code Floating
By default your code blocks will be floated to a column on the right side of your content. To disable this feature, set the `float` property to `false`.
```json
{
"html": { "float": false }
}
```
#### Toggling Code Blocks
Some users might wish to hide the code blocks & view just the documentation. By setting the `toggle_code` property to `true`, you can offer a toggle button on the page.
```json
{
"html": { "toggle_code": true }
}
```
#### GitHub Repo
Add a 'Fork me on GitHub' ribbon.
```json
{
"html": { "repo": "justinwalsh/daux.io" }
}
```
#### Twitter
Include twitter follow buttons in the sidebar.
```json
{
"html": { "twitter": ["justin_walsh", "todaymade"] }
}
```
#### Links
Include custom links in the sidebar.
```json
{
"html": {
"links": {
"GitHub Repo": "https://github.com/justinwalsh/daux.io",
"Help/Support/Bugs": "https://github.com/justinwalsh/daux.io/issues",
"Made by Todaymade": "http://todaymade.com"
}
}
}
```
#### Google Analytics
This will embed the google analytics tracking code.
```json
{
"html": { "google_analytics": "UA-XXXXXXXXX-XX" }
}
```
#### Piwik Analytics
This will embed the piwik tracking code.
```json
{
"html": { "piwik_analytics": "my-url-for-piwik.com" }
}
```
You can Also give a specific Piwik ID as well.
```json
{
"html": { "piwik_analytics_id": "43" }
}
```
#### Breadcrumb titles
Daux.io provides the option to present page titles as breadcrumb navigation. You can *optionally* specify the separator used for breadcrumbs.
```json
{
"html": {
"breadcrumbs": true,
"breadcrumb_separator" : " > "
}
}
```
#### Date Modified
By default, daux.io will display the last modified time as reported by the system underneath the title for each document. To disable this, change the option in your config.json to false.
```json
{
"html": { "date_modified": false }
}
```
### Confluence Upload Configuration
#### Configuring the connection
The connection requires three parameters `base_url`, `user` and `pass`. While `user` and `pass` don't really need an explanation, for `base_url` you need to set the path to the server without `rest/api`, this will be added automatically.
```json
{
"confluence": {
"base_url": "http://my_confluence_server.com/,
"user" : "my_username",
"pass" : "my_password",
}
}
```
#### Where to upload
Now that the connection is defined, you need to tell it where you want your documentation to be uploaded.
For that you need a `space_id` (name that appears at the beginning of the urls) and an `ancestor_id`; the id of the page that will be the parent of the documentation's homepage.
You can obtain the `ancestor_id` id by editing the page you want to define as a parent: the ID is at the end of the URL
```json
{
"confluence": {
"space_id": "my_space",
"ancestor_id": 50370632
}
}
```
#### Prefix
Because confluence can't have two pages with the same name in a space, I recommend you define a prefix for your pages.
```json
{
"confluence": { "prefix": "[DAUX]" }
}
```
## Live mode
Keep in mind, this mode can be used for production, but it is not recommended.
The whole directory must be scanned on each request. This might not make a big impact on small documentations but can be a bottleneck on bigger ones.
### Running Locally
There are several ways to run the docs locally. You can use something like <a href="http://www.mamp.info/en/index.html" target="_blank">MAMP</a> or <a href="http://www.wampserver.com/en/" target="_blank">WAMP</a>.
The easiest is to use PHP 5.4's built-in server.
For that i've included a short command, run `./serve` in the projects folder to start the local web server. By default the server will run at: <a href="http://localhost:8085" target="_blank">http://localhost:8085</a>
### Running Remotely
Copy the files from the repo to a web server that can run PHP 5.3 or greater.
## Running Locally
There is an included `.htaccess` for Apache web server.
There are several ways to run the docs locally. You can use something like <a href="http://www.mamp.info/en/index.html" target="_blank">MAMP</a> or <a href="http://www.wampserver.com/en/" target="_blank">WAMP</a>. If you are like me and use alot of Node.js and <a href="http://gruntjs.com/" target="_blank">Grunt.js</a>, then you can use the optional grunt command I have packaged with the project which will start a PHP web server for you in the project folder.
### Clean URLs configuration
The Grunt.js task uses the built in web server in PHP 5.4 to host the docs on your local machine. This is really only intended be used when you are writing/updating a ton of docs and want to preview the changes locally.
Daux provides native support for Clean URLs provided the webserver has its URL Rewrite module enabled. To enable the same, set the toggle in the `config.json` file in the `/docs` folder.
**To use the optional Grunt command you will need:**
* Node.js
* npm
* Grunt.js
* PHP 5.4 or greater (This is because of the built-in web server packaged in 5.4)
This project contains a package.json file, so once you have the requirements installed, you can simply run a `npm install` and then `grunt` in the projects folder to start the local web server. By default the server will run at: <a href="http://localhost:8085" target="_blank">http://localhost:8085</a>
## Generating a set of static files
These can be uploaded to a static site hosting service such as pages.github.com
Generating a complete set of pages, with navigation
```bash
php generate.php [global.json Relative Location] [Output Directory Relative Direction]
```json
{
"live": {
"clean_urls": true
}
}
```
## Running on IIS
### Running on IIS
If you have set up a local or remote IIS web site, you may need a `web.config` with:
* A rewrite configuration, for handling clean urls.
* A mime type handler for less files, if using a custom theme.
### Clean URLs
#### Clean URLs
The `web.config` needs an entry for `<rewrite>` under `<system.webServer>`:
@ -339,22 +464,6 @@ The `web.config` needs an entry for `<rewrite>` under `<system.webServer>`:
To use clean URLs on IIS 6, you will need to use a custom URL rewrite module, such as [URL Rewriter](http://urlrewriter.net/).
### Less Mime Type
The `web.config` needs a new `<mimeMap>` entry, under `<staticContent>` in `<system.webServer>`:
```xml
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent>
```
You will only need the mime map entry if you are using a custom theme and receive 404s for `.less` files.
If you have a global mime map entry for `.less` files set for the server, you will receive an internal server (500) error for having duplicate mime map entries.
## Support
If you need help using Daux.io, or have found a bug, please create an issue on the <a href="https://github.com/justinwalsh/daux.io/issues" target="_blank">GitHub repo</a>.
[Code Highlighting examples](!Examples/Code_Highlighting)

View File

@ -1,38 +1,3 @@
Let's get the whole "linebreak" thing out of the way. The next paragraph contains two phrases separated by a single newline character:
Roses are red
Violets are blue
The next paragraph has the same phrases, but now they are separated by two spaces and a newline character:
Roses are red
Violets are blue
Oh, and one thing I cannot stand is the mangling of words with multiple underscores in them like perform_complicated_task or do_this_and_do_that_and_another_thing.
A bit of the GitHub spice
-------------------------
In addition to the changes in the previous section, certain references are auto-linked:
* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* \#Num: #1
* User/#Num: mojombo#1
* User/Project#Num: mojombo/god#1
These are dangerous goodies though, and we need to make sure email addresses don't get mangled:
My email addy is tom@github.com.
Math is hard, let's go shopping
-------------------------------
In first grade I learned that 5 > 3 and 2 < 7. Maybe some arrows. 1 -> 2 -> 3. 9 <- 8 <- 7.
Triangles man! a^2 + b^2 = c^2
We all like making lists
------------------------

View File

@ -19,8 +19,12 @@
* Built On Bootstrap
* No Build Step
* Git/SVN Friendly
* Google Analytics
* Supports Google Analytics and Piwik Analytics
* Optional code float layout
* Static Output Generation
* Internal documentation links
* Multiple Output Formats
* Extend Daux.io with Processors
<div class="clear"></div>
<hr/>

3
serve Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
php -S 0.0.0.0:8085 index.php