Skip to main content

DocServe

A tool for quick and easy Markdown project documentation.

DocServe renders an adapted Markdown to provide:

  • Images, Video, YouTube links, CSV tables.
  • Code highlighting.
  • File download blocks.
  • Lists and Tables.
  • Document defined template selection.
  • Document Meta-data.
  • Auto-generated index sidebar.

DocServe can be used as a server to:

  • Output documents as insecure HTML on a localhost.
  • Output documents as PDF files via the HTML server.

DocServe can also:

  • Create a static set of HTML files that contain the documentation and related resources.

Basic usage with the default template:

python -m pip install docserve
mkdir docs
vim docs/home.md # then add some documentation
docserve

Basic usage with a custom template:

python -m pip install docserve
docserve --new # copies sample style and docs into working directory
docserve # run the server

Roadmap

We are requesting pull-requests for the following features:

  • Clearer heading CSS. H1 and H2 are confusing.
  • Test cases and CI steps
  • Reload on new files.
  • Windows EXE bundle for non-developer use.
  • Responsive design in default template.
  • Generate a large PDF file made from multiple documents (including table of contents with page numbers).
  • Gravatar print CSS / absent internet in the default theme.
  • Examples of Python extensions and SCSS extensions.
  • New template themes.

Getting Started

If you are running from the script:

python docserve.py                       # start a server on localhost:5000

python docserve.py --html                # freeze the server into a static site as a set of HTML files
                                         # this will exit with -1 if there was a problem parsing any file

python docserve.py --port                # specify a port for docserve to accept requests on

python docserve.py --pdf                 # generate a set of pdf files for each .md file - won't pull through
                                         # static resource files like with the --html command

python docserve.py --new                 # copy default templates and sample docs into the working directory
                                         # and update the config too, only if they don't already exist

python docserve.py --new-force           # copy default templates and sample docs into the working directory
                                         # and update the config too, this will overwrite any existing docs or
                                         # configs.


python docserve.py --dirs                # display all the different directories docserve will use to generate
                                         # the documentation

python docserve.py --find-orphans        # display unreferenced media assets in the documentation
python docserve.py --find-broken-links   # display external broken links in the documentation

Writing Documentation

Documents are managed using meta-data at the top of each document. Documents can select which template they present themselves with. Documents must end in lowercase .md. For example: mydocument.md.

Environment variables

  • DS_FLASK_DEBUG flag for enabling or disabling flask debug. Defaults to TRUE.
  • DS_FLASK_CHANGERELOAD flag for reloading the server when a file changes. Defaults to TRUE. If set, this forces DS_FLASK_DEBUG to TRUE.
  • DS_WKHTMLTOPDF the path to the WkHTMLtoPDF binary. Defaults to wkhtmltopdf_0.12.5.exe.
  • DS_DOCS_DIR the path to the directory that contains the documents. Defaults to docs.
  • DS_STYLE_DIR the path to the directory that contains the style templates and resources. Defaults to style.
  • DS_PROJECT_LOGO the path to the project logo PNG file. Defaults to logo.png in the current working directory.

Development

Virtual Environment

python -m virtualenv env
env/Scripts/activate.bat # or the bash equivalent
pip install -r requirements.txt
python docserve.py # with options
pip install flake8
flake8 docserve.py --max-line-length=120

WkHTMLtoPDF

To enable PDF output, WkHTMLtoPDF must be set in the config DS_WKHTMLTOPDF or wkhtmltopdf_0.12.5.exe placed in working directory.

This build uses version 0.12.5. Get it from here: https://wkhtmltopdf.org/downloads.html

SCSS

The default theme is built using SCSS.

The SASSC compiler can be found here: http://libsass.ocbnet.ch/installer/ Usage: sassc style/static/default.scss style/static/default.css

If you want it to auto-watch, run as admin from this directory, and remember to disable your browser cache:

pip install watchdog
watchmedo shell-command --patterns="*.scss" --recursive --command='echo "${watch_src_path}" && sassc style/static/default.scss style/static/default.css' .

Style

We use flake8 docserve.py --max-line-length=110 to static check the code.

Rebuilding the Package

python -m pip install --user --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel

python -m twine upload dist/*

Metadata

Release files for docserve 0.9.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docserve 0.9.7
File Size Uploaded Provenance Actions
docserve-0.9.7.tar.gz 10.6 MB Without provenance Details for docserve-0.9.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for docserve 0.9.7
File Interpreter ABI Platform Actions
docserve-0.9.7-py3-none-any.whl Python 3 none any Details for docserve-0.9.7-py3-none-any.whl

Total release size: 21.1 MB

Release files / docserve-0.9.7.tar.gz

Download URL docserve-0.9.7.tar.gz
Size 10.6 MB
Tags Source
SHA-256 checksum
How to use checksums
a9cf98f846e0ee3aaf780aed225cec7a60fd8334b935f9816d2da1ef66e5c016
BLAKE2b-256 checksum
How to use checksums
8b487d84f818ee7375a33a0f1bc6b1d520c1ba38c5966ee07dbe8188499cfd77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.9.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.2

Release files / docserve-0.9.7-py3-none-any.whl

Download URL docserve-0.9.7-py3-none-any.whl
Size 10.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a34b7def09a6b38a3088462c0f163c719f2b6300a1e289e8bc81827288cfc211
BLAKE2b-256 checksum
How to use checksums
dac3cd48e00c797d19655669303bfc7b92036d5454312af7cbc96f915ea3a600
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.9.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.2

Security for docserve 0.9.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page