|
| 1 | +Welcome to the DFGraph Spark Package documentation! |
| 2 | + |
| 3 | +This readme will walk you through navigating and building the DFGraph documentation, which is |
| 4 | +included here with the source code. |
| 5 | + |
| 6 | +Read on to learn more about viewing documentation in plain text (i.e., markdown) or building the |
| 7 | +documentation yourself. Why build it yourself? So that you have the docs that correspond to |
| 8 | +whichever version of DFGraph you currently have checked out of revision control. |
| 9 | + |
| 10 | +## Generating the Documentation HTML |
| 11 | + |
| 12 | +We include the DFGraph documentation as part of the source (as opposed to using a hosted wiki, such as |
| 13 | +the github wiki, as the definitive documentation) to enable the documentation to evolve along with |
| 14 | +the source code and be captured by revision control (currently git). This way the code automatically |
| 15 | +includes the version of the documentation that is relevant regardless of which version or release |
| 16 | +you have checked out or downloaded. |
| 17 | + |
| 18 | +In this directory you will find textfiles formatted using Markdown, with an ".md" suffix. You can |
| 19 | +read those text files directly if you want. Start with index.md. |
| 20 | + |
| 21 | +The markdown code can be compiled to HTML using the [Jekyll tool](http://jekyllrb.com). |
| 22 | +`Jekyll` and a few dependencies must be installed for this to work. We recommend |
| 23 | +installing via the Ruby Gem dependency manager. Since the exact HTML output |
| 24 | +varies between versions of Jekyll and its dependencies, we list specific versions here |
| 25 | +in some cases: |
| 26 | + |
| 27 | + $ sudo gem install jekyll |
| 28 | + $ sudo gem install jekyll-redirect-from |
| 29 | + |
| 30 | +Execute `jekyll build` from the `docs/` directory to compile the site. Compiling the site with Jekyll will create a directory |
| 31 | +called `_site` containing index.html as well as the rest of the compiled files. |
| 32 | + |
| 33 | +You can modify the default Jekyll build as follows: |
| 34 | + |
| 35 | + # Skip generating API docs (which takes a while) |
| 36 | + $ SKIP_API=1 jekyll build |
| 37 | + # Serve content locally on port 4000 |
| 38 | + $ jekyll serve --watch |
| 39 | + # Build the site with extra features used on the live page |
| 40 | + $ PRODUCTION=1 jekyll build |
| 41 | + |
| 42 | +## Pygments |
| 43 | + |
| 44 | +We also use pygments (http://pygments.org) for syntax highlighting in documentation markdown pages, |
| 45 | +so you will also need to install that (it requires Python) by running `sudo pip install Pygments`. |
| 46 | + |
| 47 | +To mark a block of code in your markdown to be syntax highlighted by jekyll during the compile |
| 48 | +phase, use the following sytax: |
| 49 | + |
| 50 | + {% highlight scala %} |
| 51 | + // Your scala code goes here, you can replace scala with many other |
| 52 | + // supported languages too. |
| 53 | + {% endhighlight %} |
| 54 | + |
| 55 | +## Sphinx |
| 56 | + |
| 57 | +We use Sphinx to generate Python API docs, so you will need to install it by running |
| 58 | +`sudo pip install sphinx`. |
| 59 | + |
| 60 | +## API Docs (Scaladoc, Sphinx) |
| 61 | + |
| 62 | +You can build just the scaladoc by running `build/sbt unidoc` from the DFGRAPH_PROJECT_ROOT directory. |
| 63 | + |
| 64 | +Similarly, you can build just the Python docs by running `make html` from the |
| 65 | +DFGRAPH_PROJECT_ROOT/python/docs directory. Documentation is only generated for classes that are listed as |
| 66 | +public in `__init__.py`. |
| 67 | + |
| 68 | +When you run `jekyll` in the `docs` directory, it will also copy over the scaladoc for the various |
| 69 | +subprojects into the `docs` directory (and then also into the `_site` directory). We use a |
| 70 | +jekyll plugin to run `build/sbt unidoc` before building the site so if you haven't run it (recently) it |
| 71 | +may take some time as it generates all of the scaladoc. The jekyll plugin also generates the |
| 72 | +Python docs [Sphinx](http://sphinx-doc.org/). |
| 73 | + |
| 74 | +NOTE: To skip the step of building and copying over the Scala, Python API docs, run `SKIP_API=1 |
| 75 | +jekyll`. |
0 commit comments