Skip to content

Commit db15322

Browse files
committed
replace mkdocs with sphinx/myst-parser for HTML documentation generation
- fixes #1451 - tools/.gitattributes: exclude doc/conf.py and doc/requirements.txt from zip exports - tools/doc/sphinx: suppress myst.xref_missing warnings caused by executablebooks/MyST-Parser#564 - dockerfile: use makefile/sphinx instead of mkdocs to build HTML documentation - dockerfile: add bash to the docs build container (make: bash: No such file or directory) - tools/doc/readthedocs: force use of python 3.11 (readthedocs ERROR: No matching distribution found for sphinx==7.1.0) - tools/doc/readthedocs: add all required configuration variables https://docs.readthedocs.io/en/latest/config-file/v2.html#build-os - tools/doc/readthedocs: override build commands to allow the source directory to be different from the conf.py directory (https://docs.readthedocs.io/en/stable/config-file/v2.html#build-commands, readthedocs/readthedocs.org#1543) - tools/doc/readthedocs: manually set output directory (readthedocs ERROR: No _readthedocs/html folder was created during this build.) - doc: replace all references to mkdocs with sphinx
1 parent c4d3e2d commit db15322

File tree

10 files changed

+92
-81
lines changed

10 files changed

+92
-81
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Dockerfile* export-ignore
4040
Doxyfile export-ignore
4141
Makefile export-ignore
4242
node_modules/ export-ignore
43-
mkdocs.yml export-ignore
43+
doc/conf.py export-ignore
44+
doc/requirements.txt export-ignore
4445
phpunit.xml export-ignore
4546
tests/ export-ignore

.readthedocs.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@
55
# Required
66
version: 2
77

8-
# Build documentation with MkDocs
9-
mkdocs:
10-
configuration: mkdocs.yml
8+
# Build documentation in the "docs/" directory with Sphinx
9+
sphinx:
10+
configuration: doc/conf.py
11+
builder: html
12+
13+
build:
14+
os: ubuntu-22.04
15+
tools:
16+
python: "3.11"
17+
commands:
18+
- pip install sphinx==7.1.0 furo==2023.7.26 myst-parser sphinx-design
19+
- sphinx-build -b html -c doc/ doc/md/ _readthedocs/html/
1120

12-
# Optionally set the version of Python and requirements required to build your docs
13-
# https://github.com/rtfd/readthedocs.org/issues/5250
1421
python:
15-
version: 3.5
22+
install:
23+
- requirements: doc/requirements.txt

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
FROM python:3-alpine as docs
55
ADD . /usr/src/app/shaarli
66
RUN cd /usr/src/app/shaarli \
7-
&& apk add --no-cache gcc musl-dev \
8-
&& pip install --no-cache-dir mkdocs \
9-
&& mkdocs build --clean
7+
&& apk add --no-cache gcc musl-dev make bash \
8+
&& make htmldoc
109

1110
# Stage 2:
1211
# - Resolve PHP dependencies with Composer

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ generate_authors:
159159
phpdoc: clean
160160
@docker run --rm -v $(PWD):/data -u `id -u`:`id -g` phpdoc/phpdoc
161161

162-
### generate HTML documentation from Markdown pages with MkDocs
162+
### generate HTML documentation from Markdown pages with Sphinx
163163
htmldoc:
164164
python3 -m venv venv/
165165
bash -c 'source venv/bin/activate; \
166166
pip install wheel; \
167-
pip install mkdocs; \
168-
mkdocs build --clean'
167+
pip install sphinx==7.1.0 furo==2023.7.26 myst-parser sphinx-design; \
168+
sphinx-build -b html -c doc/ doc/md/ doc/html/'
169169
find doc/html/ -type f -exec chmod a-x '{}' \;
170170
rm -r venv
171171

doc/conf.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
3+
project = 'shaarli'
4+
author = 'shaarli community'
5+
version = '0.12.2'
6+
release = '0.12.2'
7+
copyright = '2011-2023, the shaarli community'
8+
language = 'en'
9+
html_title = 'Shaarli documentation'
10+
html_theme = 'furo'
11+
html_show_sphinx = False
12+
html_show_search_summary = True
13+
html_copy_source = False
14+
html_show_copyright = True
15+
html_use_opensearch = 'https://shaarli.readthedocs.io/'
16+
html_logo = 'md/images/doc-logo.svg'
17+
html_favicon = 'md/images/icon.png'
18+
extensions = ['myst_parser', 'sphinx_design']
19+
source_suffix = ['.md']
20+
templates_path = ['_templates']
21+
exclude_patterns = []
22+
suppress_warnings = ["myst.xref_missing"]
23+
24+
# myst-parser configuration (https://myst-parser.readthedocs.io/en/latest/configuration.html)
25+
myst_enable_extensions = ['fieldlist']
26+
myst_html_meta = {
27+
"description lang=en": "The personal, minimalist, super fast, database-free bookmarking service",
28+
"charset": "UTF-8"
29+
}
30+
31+
# theme configuration (https://pradyunsg.me/furo/customisation/)
32+
html_theme_options = {
33+
"top_of_page_button": None,
34+
# "announcement": "Example announcement!"
35+
"source_repository": "https://github.com/shaarli/shaarli",
36+
"source_branch": "master",
37+
"footer_icons": [
38+
{
39+
"name": "GitHub",
40+
"url": "https://github.com/shaarli/shaarli",
41+
"html": """
42+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
43+
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
44+
</svg>
45+
""",
46+
"class": "",
47+
},
48+
]
49+
}

doc/custom_theme/main.html

Lines changed: 0 additions & 23 deletions
This file was deleted.

doc/md/dev/Development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ See [`.github/workflows/`](https://github.com/shaarli/Shaarli/tree/master/.githu
161161

162162
### Documentation
163163

164-
[mkdocs](https://www.mkdocs.org/) is used to convert markdown documentation to HTML pages. The [public documentation](https://shaarli.readthedocs.io/en/master/) website is rendered and hosted by [readthedocs.org](https://readthedocs.org/). A copy of the documentation is also included in prebuilt [release archives](https://github.com/shaarli/Shaarli/releases) (`doc/html/` path in your Shaarli installation). To generate the HTML documentation locally, install a recent version of Python `setuptools` and run `make doc`.
164+
[Sphinx](https://www.sphinx-doc.org/en/master/) is used to convert markdown documentation to HTML pages. The [public documentation](https://shaarli.readthedocs.io/en/master/) website is rendered and hosted by [readthedocs.org](https://readthedocs.org/). A copy of the documentation is also included in prebuilt [release archives](https://github.com/shaarli/Shaarli/releases) (`doc/html/` path in your Shaarli installation). To generate the HTML documentation locally, run `make htmldoc`.
165165

166166

167167
## Static analysis

doc/md/index.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,23 @@ Visit the pages in the sidebar to find information on how to setup, use, configu
1313

1414
[![](https://i.imgur.com/8wEBRSG.png)](https://i.imgur.com/WWPfSj0.png) [![](https://i.imgur.com/93PpLLs.png)](https://i.imgur.com/V09kAQt.png) [![](https://i.imgur.com/rrsjWYy.png)](https://i.imgur.com/TZzGHMs.png) [![](https://i.imgur.com/8iRzHfe.png)](https://i.imgur.com/sfJJ6NT.png) [![](https://i.imgur.com/GjZGvIh.png)](https://i.imgur.com/QsedIuJ.png) [![](https://i.imgur.com/TFZ9PEq.png)](https://i.imgur.com/KdtF8Ll.png) [![](https://i.imgur.com/uICDOle.png)](https://i.imgur.com/27wYsbC.png) [![](https://i.imgur.com/tVvD3gH.png)](https://i.imgur.com/zGF4d6L.jpg)
1515

16-
16+
```{toctree}
17+
:maxdepth: 1
18+
:hidden:
19+
20+
Server-configuration.md
21+
Installation.md
22+
Reverse-proxy.md
23+
Docker.md
24+
Shaarli-configuration.md
25+
Usage.md
26+
Backup-and-restore.md
27+
Upgrade-and-migration.md
28+
Community-and-related-software.md
29+
Plugins.md
30+
REST-API.md
31+
Troubleshooting.md
32+
```
1733

1834
## Demo
1935

doc/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sphinx==7.1.0
2+
furo==2023.7.26
3+
myst-parser
4+
sphinx-design

mkdocs.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)