├── MANIFEST.in ├── setup.cfg ├── doc ├── requirements.txt ├── Makefile ├── dokieli.md ├── hypothesis.md ├── index.md ├── utterances.md └── conf.py ├── readthedocs.yml ├── tests ├── test_comments │ ├── dokieli.html │ ├── hypothesis.html │ └── utterances.html ├── config │ └── conf.py └── test_comments.py ├── LICENSE ├── CHANGELOG.md ├── setup.py ├── .github └── workflows │ └── integration.yml ├── README.md ├── .gitignore └── sphinx_comments └── __init__.py /MANIFEST.in: -------------------------------------------------------------------------------- 1 | graft doc/ 2 | prune doc/_build 3 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | license_file = LICENSE 3 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx>=2 2 | sphinx_book_theme 3 | myst_parser 4 | 5 | # Install ourselves 6 | . 7 | -------------------------------------------------------------------------------- /readthedocs.yml: -------------------------------------------------------------------------------- 1 | name: sphinx-comments 2 | type: sphinx 3 | requirements_file: doc/requirements.txt 4 | python: 5 | version: 3 6 | -------------------------------------------------------------------------------- /tests/test_comments/dokieli.html: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /tests/test_comments/hypothesis.html: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 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 = SphinxComments 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) -------------------------------------------------------------------------------- /doc/dokieli.md: -------------------------------------------------------------------------------- 1 | # Dokieli 2 | 3 | ```{raw} html 4 | 5 | 6 | ``` 7 | 8 | ```{warning} 9 | Dokieli is experimental and may not behave as expected right now! 10 | ``` 11 | 12 | [`dokie.li`](https://dokie.li/) is a clientside editor for decentralised article publishing, annotations and social interactions. Dokieli is activated on this page. You can see the web overlay by clicking on the hamburger menu in the upper-right corner of this page. 13 | 14 | ## Activate `dokie.li` 15 | 16 | You can activate [`dokie.li`](https://dokie.li/) 17 | by adding the following to your `conf.py` file: 18 | 19 | ```python 20 | comments_config = { 21 | "dokieli": True 22 | } 23 | ``` 24 | 25 | Next, [follow the `dokie.li` configuration instructions](https://dokie.li/). 26 | 27 | When you build your documentation, pages will now have an active dokieli overlay. 28 | -------------------------------------------------------------------------------- /doc/hypothesis.md: -------------------------------------------------------------------------------- 1 | # Hypothesis 2 | 3 | ```{raw} html 4 | 5 | ``` 6 | 7 | Hypothesis is a centralized web services that allows you to comment and annotate arbitrary web pages across the web. 8 | 9 | Hypothesis is activated on this page. You can see the web overlay by clicking on the `<` button in the upper-right corner of this page. 10 | 11 | ## Activate `hypothes.is` 12 | 13 | You can activate `hypothes.is` by adding the following to your `conf.py` file: 14 | 15 | ```python 16 | comments_config = { 17 | "hypothesis": True 18 | } 19 | ``` 20 | 21 | This will add a [hypothes.is overlay](https://web.hypothes.is/) to your documentation. This extension simply activates the hypothes.is javascript bundle on your Sphinx site. This will cause the hypothes.is overlay to be shown, allowing your readers to log-in and comment on your documentation if they have questions. 22 | 23 | When you build your documentation, you will see the hypothes.is overlay to the right of your screen. 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Executable Books Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tests/test_comments/utterances.html: -------------------------------------------------------------------------------- 1 | 34 | -------------------------------------------------------------------------------- /doc/index.md: -------------------------------------------------------------------------------- 1 | # Sphinx Comments 2 | 3 | Add comments and annotation functionality to your Sphinx website. 4 | 5 | Currently, these commenting engines are supported: 6 | 7 | - [Hypothes.is](https://hypothes.is/) provides a web overlay that allows you to annotate and comment collaboratively. 8 | - [utteranc.es](https://utteranc.es/) is a web commenting system that uses GitHub Issues to store and manage comments. 9 | - [`dokie.li`](https://dokie.li/) is an open source commenting and annotation overlay built on web standards. 10 | 11 | For examples of each service, as well as instructions for how to activate it, 12 | click on the links to the left. 13 | 14 | ## Installation 15 | 16 | Clone and install the github reposiory 17 | 18 | ```bash 19 | pip install sphinx-comments 20 | ``` 21 | 22 | Next, activate the extension by adding it to your `conf.py` file: 23 | 24 | ```python 25 | ... 26 | extensions = [ 27 | "sphinx_comments" 28 | ] 29 | ``` 30 | 31 | ## Configuration 32 | 33 | To configure `sphinx-comments` (and to choose the engine you'd like to use), 34 | you should configure the `comments_config` dictionary in `conf.py`. Instructions 35 | for doing so can be found in the page for each of the supported engines below. 36 | 37 | ```{toctree} 38 | :caption: Supported engines 39 | :maxdepth: 2 40 | hypothesis 41 | dokieli 42 | utterances 43 | ``` 44 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # v0.0.* changes 2 | 3 | ([full changelog](https://github.com/executablebooks/sphinx-comments/compare/57892fa6d89827cc079b979744dd2da95f341bc8...9a4748fdfd1832ef5c2bd35d1ff008e3d7656709)) 4 | 5 | 6 | ## Bugs fixed 7 | * 🐛 BUG: fixing multiple script installs [#11](https://github.com/executablebooks/sphinx-comments/pull/11) ([@choldgraf](https://github.com/choldgraf)) 8 | 9 | ## Documentation improvements 10 | * 📚 DOCS: Improving documentation [#8](https://github.com/executablebooks/sphinx-comments/pull/8) ([@choldgraf](https://github.com/choldgraf)) 11 | * 📚 DOCS: Infra for docs [#7](https://github.com/executablebooks/sphinx-comments/pull/7) ([@choldgraf](https://github.com/choldgraf)) 12 | 13 | ## Other merged PRs 14 | * testing infra [#6](https://github.com/executablebooks/sphinx-comments/pull/6) ([@choldgraf](https://github.com/choldgraf)) 15 | 16 | ## Contributors to this release 17 | ([GitHub contributors page for this release](https://github.com/executablebooks/sphinx-comments/graphs/contributors?from=2020-08-01&to=2020-08-12&type=c)) 18 | 19 | [@choldgraf](https://github.com/search?q=repo%3Aexecutablebooks%2Fsphinx-comments+involves%3Acholdgraf+updated%3A2020-08-01..2020-08-12&type=Issues) | [@welcome](https://github.com/search?q=repo%3Aexecutablebooks%2Fsphinx-comments+involves%3Awelcome+updated%3A2020-08-01..2020-08-12&type=Issues) 20 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | from setuptools import setup, find_packages 4 | 5 | with open("./README.md", "r") as ff: 6 | readme_text = ff.read() 7 | 8 | path_doc_reqs = Path("./doc/requirements.txt") 9 | doc_reqs = [ 10 | ii 11 | for ii in path_doc_reqs.read_text(encoding="utf8").split("\n") 12 | if ii and not ii.startswith("#") and ii != "." 13 | ] 14 | # Parse version 15 | init = Path(__file__).parent.joinpath("sphinx_comments", "__init__.py") 16 | for line in init.read_text().split("\n"): 17 | if line.startswith("__version__ ="): 18 | break 19 | version = line.split(" = ")[-1].strip('"') 20 | 21 | setup( 22 | name="sphinx-comments", 23 | version=version, 24 | description="Add comments and annotation to your documentation.", 25 | long_description=readme_text, 26 | long_description_content_type="text/markdown", 27 | author="Executable Book Project", 28 | url="https://github.com/executablebooks/sphinx-comments", 29 | license="MIT License", 30 | packages=find_packages(), 31 | classifiers=["License :: OSI Approved :: MIT License"], 32 | install_requires=["sphinx>=1.8",], 33 | extras_require={ 34 | "code_style": ["flake8<3.8.0,>=3.7.0", "black", "pre-commit==1.17.0"], 35 | "sphinx": doc_reqs, 36 | "testing": ["beautifulsoup4", "myst-parser", "pytest", "pytest-regressions",] 37 | + doc_reqs, 38 | }, 39 | ) 40 | -------------------------------------------------------------------------------- /tests/config/conf.py: -------------------------------------------------------------------------------- 1 | # -- Project information ----------------------------------------------------- 2 | 3 | project = "Test build" 4 | copyright = "2018, Executable Books Project" 5 | author = "Executable Books Project" 6 | 7 | extensions = ["sphinx_comments", "myst_parser"] 8 | 9 | comments_config = { 10 | "hypothesis": True, 11 | "utterances": {"repo": "executablebooks/sphinx-comments", "theme": "footheme",}, 12 | "dokieli": True, 13 | } 14 | 15 | # The master toctree document. 16 | master_doc = "index" 17 | 18 | # The language for content autogenerated by Sphinx. Refer to documentation 19 | # for a list of supported languages. 20 | # 21 | # This is also used if you do content translation via gettext catalogs. 22 | # Usually you set "language" from the command line for these cases. 23 | language = None 24 | 25 | # List of patterns, relative to source directory, that match files and 26 | # directories to ignore when looking for source files. 27 | # This pattern also affects html_static_path and html_extra_path . 28 | exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] 29 | 30 | # The name of the Pygments (syntax highlighting) style to use. 31 | pygments_style = "sphinx" 32 | 33 | 34 | # -- Options for HTML output ------------------------------------------------- 35 | 36 | # The theme to use for HTML and HTML Help pages. See the documentation for 37 | # a list of builtin themes. 38 | # 39 | html_theme = "sphinx_book_theme" 40 | -------------------------------------------------------------------------------- /.github/workflows/integration.yml: -------------------------------------------------------------------------------- 1 | name: continuous-integration 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | 7 | tests: 8 | 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | python-version: [3.6, 3.7, 3.8] 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up Python ${{ matrix.python-version }} 17 | uses: actions/setup-python@v1 18 | with: 19 | python-version: ${{ matrix.python-version }} 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | git submodule update --init 24 | pip install -e .[testing] 25 | 26 | - name: Run pytest 27 | run: | 28 | pytest 29 | 30 | publish: 31 | 32 | name: Publish to PyPi 33 | needs: [tests] 34 | if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') 35 | runs-on: ubuntu-latest 36 | steps: 37 | - name: Checkout source 38 | uses: actions/checkout@v2 39 | - name: Set up Python 3.7 40 | uses: actions/setup-python@v1 41 | with: 42 | python-version: 3.7 43 | - name: Build package 44 | run: | 45 | pip install wheel 46 | git submodule update --init 47 | python setup.py sdist bdist_wheel 48 | - name: Publish 49 | uses: pypa/gh-action-pypi-publish@v1.1.0 50 | with: 51 | user: __token__ 52 | password: ${{ secrets.PYPI_KEY }} 53 | -------------------------------------------------------------------------------- /doc/utterances.md: -------------------------------------------------------------------------------- 1 | # Utterances 2 | 3 | Utterances is a commenting engine built on top of GitHub issues. It embeds a comment box in your page that users (with a GitHub account) can use to ask questions. These become comments in a GitHub issue in a repository of your choice. 4 | 5 | Utterances is activated on this page. You can see the comment box at the bottom of the page's content. Click the "log in" button and you'll be able to post comments! 6 | 7 | ## Activate `utteranc.es` 8 | 9 | You can activate `utteranc.es` by adding the following to your `conf.py` file: 10 | 11 | ```python 12 | comments_config = { 13 | "utterances": { 14 | "repo": "github-org/github-repo", 15 | "optional": "config", 16 | } 17 | } 18 | ``` 19 | 20 | ```{note} 21 | You can pass optional extra configuration for utterances. See 22 | [the utterances documentation for your options](https://utteranc.es/#theme). 23 | ``` 24 | 25 | Next, [follow the `utteranc.es` configuration instructions](https://utteranc.es/#configuration). 26 | 27 | When you build your documentation, pages will now have a comment box at the bottom. If readers log in via GitHub they will be able to post comments that will then map onto issues in your GitHub repository. 28 | 29 | ```{raw} html 30 |