Skip to content

Commit

Permalink
DeveloperGuide: add guide to convert docs to PDF
Browse files Browse the repository at this point in the history
The documentation files are written in Markdown and published to
GitHub pages. However, PDF versions of the docs may be required, such
as for providing offline access to documentation files.

Let's update the developer guide to teach developers to use Chrome's
'Save as PDF' option to convert the online documentation to PDF format.
Chrome's 'Save as PDF' preserves the contents of HTML files well,
including the hyperlinks, and is easy to use. Furthermore, Chrome is
a commonly used web browser so developers are unlikely to have to
install additional software.
  • Loading branch information
kychua committed Feb 13, 2017
1 parent aaff772 commit b2b386c
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 2 deletions.
26 changes: 24 additions & 2 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,12 @@ See [UsingGradle.md](UsingGradle.md) to learn how to use Gradle for build automa
We use [Travis CI](https://travis-ci.org/) and [AppVeyor](https://www.appveyor.com/) to perform _Continuous Integration_ on our projects.
See [UsingTravis.md](UsingTravis.md) and [UsingAppVeyor.md](UsingAppVeyor.md) for more details.

### 5.3. Making a Release
### 5.3. Publishing Documentation

See [UsingGithubPages.md](UsingGithubPages.md) to learn how to use GitHub Pages to publish documentation to the
project site.

### 5.4. Making a Release

Here are the steps to create a new release.

Expand All @@ -308,7 +313,24 @@ Here are the steps to create a new release.
2. [Create a new release using GitHub](https://help.github.com/articles/creating-releases/)
and upload the JAR file you created.

### 5.4. Managing Dependencies
### 5.5. Converting Documentation to PDF format

We use [Google Chrome](https://www.google.com/chrome/browser/desktop/) for converting documentation to PDF format,
as Chrome's PDF engine preserves hyperlinks used in webpages.

Here are the steps to convert the project documentation files to PDF format.

1. Make sure you have set up GitHub Pages as described in [UsingGithubPages.md](UsingGithubPages.md#setting-up).
1. Using Chrome, go to the [GitHub Pages version](UsingGithubPages.md#viewing-the-project-site) of the
documentation file. <br>
e.g. For [UserGuide.md](UserGuide.md), the URL will be `https://<your-username-or-organization-name>.github.io/addressbook-level4/docs/UserGuide.html`.
1. Click on the `Print` option in Chrome's menu.
1. Set the destination to `Save as PDF`, then click `Save` to save a copy of the file in PDF format. <br>
For best results, use the settings indicated in the screenshot below. <br>
<img src="images/chrome_save_as_pdf.png" width="300"><br>
_Figure 5.4.1 : Saving documentation as PDF files in Chrome_

### 5.6. Managing Dependencies

A project often depends on third-party libraries. For example, Address Book depends on the
[Jackson library](http://wiki.fasterxml.com/JacksonHome) for XML parsing. Managing these _dependencies_
Expand Down
52 changes: 52 additions & 0 deletions docs/UsingGithubPages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Using GitHub Pages

[GitHub Pages](https://pages.github.com/) is a static site hosting service that allows users to publish
webpages using files in their GitHub repositories.

## Setting Up

GitHub Pages offers two kinds of sites: user/organization sites and project sites.
Since we are using GitHub Pages to showcase the documentation for our project, we will be creating a project site.

1. Navigate to the repository's `Settings` tab in GitHub. <br>
<img src="images/github_repo_settings.png" width="600">
1. Under the GitHub Pages section, click `Choose a theme` in `Theme chooser`. Pick a theme for the
project site and click `Select theme` when done.
1. You can now view the site at `https://<username-or-organization-name>.github.io/<repo-name>`. <br>
e.g. `https://se-edu.github.io/addressbook-level4`

Note that the publishing source has been automatically set to `master branch`.
This means that the GitHub Pages site will be published using source files in the `master` branch.
Jekyll, a static site generator integrated with GitHub Pages, automatically renders Markdown files
(in the `master` branch) to HTML, which are then deployed to the project site by GitHub Pages.

## Viewing the Project Site

The project site URL follows the format `https://<username-or-organization-name>.github.io/<repo-name>`,
e.g. `https://se-edu.github.io/addressbook-level4`.
By default, the [README](../README.md) file is displayed on this page.

For the other pages, the structure of the site follows the structure of the repository. <br>
For example, `docs/UserGuide.md` is published at `https://<username-or-organization-name>.github.io/addressbook-level4/docs/UserGuide.html`.

## Updating the Project Site

To update the project site, simply edit the documentation files in Markdown and push the changes to GitHub.
GitHub Pages automatically updates the project site when changes are committed to the `master` branch
(e.g. when the commit is pushed to the `master` branch or when the pull request containing the commit is
merged into `master`).

## Customizing the Project Site

For instructions on customizing the project site, refer to [GitHub's guides](https://help.github.com/categories/customizing-github-pages/).

## Troubleshooting

**Problem: Markdown is not displayed properly in GitHub Pages even though they appear correctly in GitHub preview**

* Reason: Jekyll (which converts Markdown to HTML for GitHub Pages) uses kramdown as its markdown engine but
GitHub preview uses GitHub's own markdown engine. Since kramdown requires stricter syntax than GitHub's markdown
engine, a Markdown file might be rendered correctly in GitHub preview but not on GitHub Pages.
* Solution: Make sure you have followed the [coding standard](https://oss-generic.github.io/process/codingStandards/CodingStandard-Gfmd.html)
for GitHub Flavored Markdown. If the problem persists, try checking [kramdown's syntax](https://kramdown.gettalong.org/parser/gfm.html)
to see if you are using the correct syntax for GitHub Pages.
Binary file added docs/images/chrome_save_as_pdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/github_repo_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b2b386c

Please sign in to comment.