Skip to content

Commit

Permalink
Add a small doc setup with just an example.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Aug 17, 2022
1 parent 4e457a5 commit b063c76
Show file tree
Hide file tree
Showing 9 changed files with 411 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ jobs:
toxenv: py310-safety
- name: "3.10"
toxenv: py310-tests
- name: "3.10"
toxenv: docs-dirhtml
- name: "3.10"
toxenv: docs-doctest
- name: "3.10"
toxenv: docs-linkcheck
- name: "3.10"
toxenv: docs-spelling
- name: "3.10"
toxenv: docs-style
- name: "3.10"
toxenv: readme
- name: "3.10"
Expand Down
15 changes: 15 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

sphinx:
builder: dirhtml
configuration: docs/conf.py
fail_on_warning: true

formats: all

python:
version: "3.8"
install:
- requirements: docs/requirements.txt
- method: pip
path: .
19 changes: 19 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
234 changes: 234 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

import importlib.metadata
import re

# -- Project information -----------------------------------------------------

project = "sphinx-json-schema-spec"
author = "Julian Berman"
copyright = "2013, " + author

# version: The short X.Y version
# release: The full version, including alpha/beta/rc tags.
release = importlib.metadata.version("sphinx_json_schema_spec")
version = release.partition("-")[0]


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = "1.0"

default_role = "any"

primary_domain = "rst"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx_json_schema_spec",
"sphinxcontrib.spelling",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = [".rst", ".md"]
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = [u"_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "furo"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``["localtoc.html", "relations.html", "sourcelink.html",
# "searchbox.html"]``.
#
# html_sidebars = {}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = "sphinxjsonschemaspecdoc"


# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
# The paper size ("letterpaper" or "a4paper").
#
# "papersize": "letterpaper",

# The font size ("10pt", "11pt" or "12pt").
#
# "pointsize": "10pt",

# Additional stuff for the LaTeX preamble.
#
# "preamble": "",

# Latex figure (float) alignment
#
# "figure_align": "htbp",
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
"Sphinx JSON Schema Spec.tex",
project,
author,
"manual",
),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(
master_doc,
project,
project,
[author],
1,
),
]


# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
project,
project,
author,
project,
"",
"Miscellaneous",
),
]


# -- Options for Epub output -------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = project

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ""

# A unique identification for the text.
#
# epub_uid = ""

# A list of files that should not be packed into the epub file.
epub_exclude_files = ["search.html"]


# -- Extension configuration -------------------------------------------------

# -- Options for autodoc extension -------------------------------------------

autodoc_default_options = {
"members": True,
"member-order": "bysource",
}

# -- Options for autosectionlabel extension ----------------------------------

autosectionlabel_prefix_document = True

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"jsonschema": (
"https://python-jsonschema.readthedocs.io/en/latest/", None,
),
"packaging": ("https://packaging.python.org/", None),
"python": ("https://docs.python.org/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
}

# -- Options for the linkcheck builder ------------------------------------


def entire_domain(host):
return r"http.?://" + re.escape(host) + r"($|/.*)"


linkcheck_ignore = [
entire_domain("codecov.io"),
entire_domain("img.shields.io"),
"https://github.com/python-jsonschema/sphinx-json-schema-spec/actions",
"https://github.com/python-jsonschema/sphinx-json-schema-spec/workflows/CI/badge.svg", # noqa: E501
]
28 changes: 28 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. _sphinx_json_schema_spec:

.. include:: ../README.rst

Usage
-----

The extension currently provides a single Sphinx `role`:

.. role:: kw

Link to the current JSON Schema specification's definition of the keyword
provided.

For instance, writing:

.. code-block:: rst
Reference resolution in JSON Schema is done using the :kw:`$ref` keyword.
will produce:

Reference resolution in JSON Schema is done using the :kw:`$ref` keyword.

What's here, albeit crude, has been used in some form for a long while by `jsonschema` (the Python library), but the hope is it may be useful to alternate implementations or users in general.
Help is very much welcome to improve it!

In the future support may be added for linking to different drafts, or for linking to `Understanding JSON Schema <https://json-schema.org/understanding-json-schema/index.html>`_.
4 changes: 4 additions & 0 deletions docs/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
file:.#egg=sphinx_json_schema_spec
furo
sphinx>=5.1
sphinxcontrib-spelling>5
75 changes: 75 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile docs/requirements.in
#
alabaster==0.7.12
# via sphinx
babel==2.10.3
# via sphinx
beautifulsoup4==4.11.1
# via furo
certifi==2022.6.15
# via requests
charset-normalizer==2.1.0
# via requests
docutils==0.19
# via sphinx
furo==2022.6.21
# via -r docs/requirements.in
idna==3.3
# via requests
imagesize==1.4.1
# via sphinx
jinja2==3.1.2
# via sphinx
lxml==4.9.1
# via sphinx-json-schema-spec
markupsafe==2.1.1
# via jinja2
packaging==21.3
# via sphinx
pyenchant==3.2.2
# via sphinxcontrib-spelling
pygments==2.13.0
# via
# furo
# sphinx
pyparsing==3.0.9
# via packaging
pytz==2022.2.1
# via babel
requests==2.28.1
# via sphinx
snowballstemmer==2.2.0
# via sphinx
soupsieve==2.3.2.post1
# via beautifulsoup4
sphinx==5.1.1
# via
# -r docs/requirements.in
# furo
# sphinx-basic-ng
# sphinx-json-schema-spec
# sphinxcontrib-spelling
sphinx-basic-ng==0.0.1a12
# via furo
file:.#egg=sphinx_json_schema_spec
# via -r docs/requirements.in
sphinxcontrib-applehelp==1.0.2
# via sphinx
sphinxcontrib-devhelp==1.0.2
# via sphinx
sphinxcontrib-htmlhelp==2.0.0
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.3
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
sphinxcontrib-spelling==7.6.0
# via -r docs/requirements.in
urllib3==1.26.11
# via requests
Empty file added docs/spelling_wordlist.txt
Empty file.
Loading

0 comments on commit b063c76

Please sign in to comment.