Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit 7191041

Browse files
committed
docs: Add Sphinx documentation site
1 parent bc90950 commit 7191041

File tree

6 files changed

+255
-0
lines changed

6 files changed

+255
-0
lines changed

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Contributing Guide
2+
3+
## Documentation
4+
5+
The documentation is built using Sphinx, a Python tool. Assuming you have
6+
Python 3 installed, the following steps can be used to build the site.
7+
8+
```shell
9+
$ cd docs/
10+
$ python3 -m venv venv
11+
$ source venv/bin/activate
12+
$ pip install -r requirements.txt
13+
```
14+
15+
## Running the Development Server
16+
17+
You can run a local development server to preview changes using the following:
18+
19+
```shell
20+
$ make watch
21+
```

docs/Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = APIElementsJS
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21+
22+
watch:
23+
@sphinx-autobuild $(SOURCEDIR) $(BUILDDIR)/html

docs/_templates/sidebar_intro.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<h1><a href="/">API Elements JavaScript</a></h1>
2+
3+
<p>
4+
<iframe
5+
src="https://ghbtns.com/github-btn.html?user=apiaryio&repo=api-elements&type=watch&count=true&size=large"
6+
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px">
7+
</iframe>
8+
</p>
9+
10+
<p>API Elements is a structure for describing APIs and the complex data structures used within them.</p>
11+
12+
<div class="social">
13+
<p>
14+
<iframe
15+
src="https://ghbtns.com/github-btn.html?user=apiaryio&type=follow&count=false"
16+
allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20">
17+
</iframe>
18+
</p>
19+
</div>
20+
21+
<a href="https://github.com/apiaryio/api-elements.js" class="github-corner" aria-label="View source on GitHub">
22+
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true">
23+
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
24+
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
25+
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
26+
</svg>
27+
</a>
28+
29+
<style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>

docs/conf.py

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
# -- General configuration ------------------------------------------------
5+
6+
# If your documentation needs a minimal Sphinx version, state it here.
7+
#
8+
# needs_sphinx = '1.0'
9+
10+
# Add any Sphinx extension module names here, as strings. They can be
11+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
12+
# ones.
13+
14+
# Add any paths that contain templates here, relative to this directory.
15+
templates_path = ['_templates']
16+
17+
# The suffix(es) of source filenames.
18+
# You can specify multiple suffix as a list of string:
19+
#
20+
# source_suffix = ['.rst', '.md']
21+
source_suffix = '.rst'
22+
23+
# The master toctree document.
24+
master_doc = 'index'
25+
26+
# General information about the project.
27+
project = 'API Elements (JS)'
28+
copyright = '2018, Apiary'
29+
author = 'Apiary'
30+
31+
# The version info for the project you're documenting, acts as replacement for
32+
# |version| and |release|, also used in various other places throughout the
33+
# built documents.
34+
#
35+
# The short X.Y version.
36+
version = ''
37+
# The full version, including alpha/beta/rc tags.
38+
release = '1.0'
39+
40+
# The language for content autogenerated by Sphinx. Refer to documentation
41+
# for a list of supported languages.
42+
#
43+
# This is also used if you do content translation via gettext catalogs.
44+
# Usually you set "language" from the command line for these cases.
45+
language = None
46+
47+
# List of patterns, relative to source directory, that match files and
48+
# directories to ignore when looking for source files.
49+
# This patterns also effect to html_static_path and html_extra_path
50+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
51+
52+
# The name of the Pygments (syntax highlighting) style to use.
53+
pygments_style = 'sphinx'
54+
55+
# If true, `todo` and `todoList` produce output, else they produce nothing.
56+
todo_include_todos = False
57+
58+
59+
# -- Options for HTML output ----------------------------------------------
60+
61+
# The theme to use for HTML and HTML Help pages. See the documentation for
62+
# a list of builtin themes.
63+
#
64+
html_theme = 'alabaster'
65+
66+
# Theme options are theme-specific and customize the look and feel of a theme
67+
# further. For a list of options available for each theme, see the
68+
# documentation.
69+
#
70+
# html_theme_options = {}
71+
72+
# Add any paths that contain custom static files (such as style sheets) here,
73+
# relative to this directory. They are copied after the builtin static files,
74+
# so a file named "default.css" will overwrite the builtin "default.css".
75+
html_static_path = ['_static']
76+
77+
# Custom sidebar templates, must be a dictionary that maps document names
78+
# to template names.
79+
#
80+
# This is required for the alabaster theme
81+
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
82+
html_sidebars = {
83+
'index': ['sidebar_intro.html', 'globaltoc.html', 'searchbox.html'],
84+
'**': ['sidebar_intro.html', 'localtoc.html', 'relations.html', 'searchbox.html'],
85+
}
86+
87+
88+
# -- Options for HTMLHelp output ------------------------------------------
89+
90+
# Output file base name for HTML help builder.
91+
htmlhelp_basename = 'APIElementsJSdoc'
92+
93+
94+
# -- Options for LaTeX output ---------------------------------------------
95+
96+
latex_elements = {
97+
# The paper size ('letterpaper' or 'a4paper').
98+
#
99+
# 'papersize': 'letterpaper',
100+
101+
# The font size ('10pt', '11pt' or '12pt').
102+
#
103+
# 'pointsize': '10pt',
104+
105+
# Additional stuff for the LaTeX preamble.
106+
#
107+
# 'preamble': '',
108+
109+
# Latex figure (float) alignment
110+
#
111+
# 'figure_align': 'htbp',
112+
}
113+
114+
# Grouping the document tree into LaTeX files. List of tuples
115+
# (source start file, target name, title,
116+
# author, documentclass [howto, manual, or own class]).
117+
latex_documents = [
118+
(master_doc, 'APIElementsJS.tex', 'API Elements (JS) Documentation',
119+
'Apiary', 'manual'),
120+
]
121+
122+
123+
# -- Options for manual page output ---------------------------------------
124+
125+
# One entry per manual page. List of tuples
126+
# (source start file, name, description, authors, manual section).
127+
man_pages = [
128+
(master_doc, 'apielementsjs', 'API Elements (JS) Documentation',
129+
[author], 1)
130+
]
131+
132+
133+
# -- Options for Texinfo output -------------------------------------------
134+
135+
# Grouping the document tree into Texinfo files. List of tuples
136+
# (source start file, target name, title, author,
137+
# dir menu entry, description, category)
138+
texinfo_documents = [
139+
(master_doc, 'APIElementsJS', 'API Elements (JS) Documentation',
140+
author, 'APIElementsJS', 'One line description of project.',
141+
'Miscellaneous'),
142+
]

docs/index.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
API Elements (JS)
2+
=================
3+
4+
Installation
5+
------------
6+
7+
.. code-block:: shell
8+
9+
$ npm install api-elements
10+
11+
Usage
12+
-----
13+
14+
.. code-block:: javascript
15+
16+
const apiElements = require('api-elements');
17+
const namespace = new apiElements.Namespace();
18+
19+
20+
// Parsing a JSON Representation of API Elements tree
21+
const parseResult = namespace.serialiser.deserialise({
22+
element: 'parseResult',
23+
content: []
24+
});
25+
26+
console.log(parseResult);
27+
28+
29+
// Creating API Elements directly
30+
const parseResult = new namespace.elements.ParseResult();
31+
console.log(parseResult);
32+
33+
Indices and tables
34+
==================
35+
36+
* :ref:`genindex`
37+
* :ref:`search`

docs/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Pygments==2.2.0
2+
Sphinx==1.6.6
3+
sphinx-autobuild==0.7.1

0 commit comments

Comments
 (0)