Skip to main content

Render Markdown documentation in the Django Admin.

Project description

django-actual-admin-docs

Render Markdown documentation directly in the Django admin`.

  • Support for nested subfolders
  • Comprehensive Markdown format (link to which spec)
  • Provides default styles for Markdown rendering

Installation

  1. Install the django-actual-admin-docs package:

    • pip install django-actual-admin-docs[highlight] if you want to enable syntax highlighting in code blocks. This adds Pygments as a dependency.

    • pip install django-actual-admin-docs if you don't need that and want to keep your third party dependencies lean.

  2. Add actual_admin_docs to your INSTALLED_APPS setting:

    INSTALLED_APPS = [
      "django.contrib.admin",
      "actual_admin_docs",
      ...
    ]
    
  3. Add the documentation urlpattern, above your admin urls:

    from django.contrib import admin
    from django.urls import include, path
    
    urlpatterns = [
        path("admin/docs/", include("actual_admin_docs.urls")),
        path("admin/", admin.site.urls),
    ]
    
  4. Add a DOCS_ROOT setting which should be a pathlib.Path pointing to the docs directory:

    DOCS_ROOT = BASE_DIR / "docs"
    

Documentation folder structure

You can use folders, subfolders, files in folders, etc.

๐Ÿ—‚ docs/
โ”‚
โ”œโ”€โ”€ ๐Ÿ—‚ subfolder   
โ”‚   โ”‚   
โ”‚   โ”œโ”€โ”€ ๐Ÿ—‚ subfolder with spaces
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“ another-file.md
โ”‚   โ”‚ 
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ another-file.md
โ”‚   โ””โ”€โ”€ ๐Ÿ“ index.md
โ”‚
โ”œโ”€โ”€ ๐Ÿ—‚ img    
โ”‚   โ””โ”€โ”€ ๐ŸŒ cat_studying_glasses.jpg
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ index.md
โ””โ”€โ”€ ๐Ÿ“ markdown-sample.md

Use regular Markdown links to link to other documents or objects:

A link to [another document](./markdown-sample.md) is just a regular Markdown link. Documents in subdirectories [are supported too](./subfolder/another-file.md).

For images, downloads etc. use regular markdown markup too:

![A cat judging your code](./img/cat_studying_glasses.jpg)
[Click to download](./img/./img/cat_studying_glasses.jpg)

Custom CSS

Overwrite the actual-admin-docs.css file to add your custom styles.


๐Ÿคบ Local Development

$ poetry install
$ poetry run pytest
$ DJANGO_SETTINGS_MODULE=actual_admin_docs.tests.testproject.settings poetry run django-admin runserver

Changelog

v0.4 2024-11-06

  • Sample documentation for testing purpose is now part of the module.
  • Added testing with docs.

v0.3 2024-11-06

  • Improved local test setup,
  • Index files are consistently recognized in subfolders.
  • Pygments as a dependency is now optional.

v0.2 2024-11-05

  • Added syntax highlighting for fenced code blocks.
  • Added Pygments as a dependency.

v0.1 2024-11-05

  • Initial version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_actual_admin_docs-0.4.tar.gz (82.0 kB view details)

Uploaded Source

Built Distribution

django_actual_admin_docs-0.4-py3-none-any.whl (82.7 kB view details)

Uploaded Python 3

File details

Details for the file django_actual_admin_docs-0.4.tar.gz.

File metadata

  • Download URL: django_actual_admin_docs-0.4.tar.gz
  • Upload date:
  • Size: 82.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for django_actual_admin_docs-0.4.tar.gz
Algorithm Hash digest
SHA256 bb118635c3730d684b08701102922b9b0ec5e597d0a7807ca41d6054d85fb9c2
MD5 cfc554de230a116cac6248631eb43ebd
BLAKE2b-256 e86483cf92b856098fa9e5483f635b543b014e08d53f7bf0cd226c800296417b

See more details on using hashes here.

File details

Details for the file django_actual_admin_docs-0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_actual_admin_docs-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 448d3886c5264dc2ea8f3476d727c9a53d8cfe0cd49c2a5f622146ad2aafed47
MD5 ea087751daf4ccd7ca78557d13fda4cb
BLAKE2b-256 c2b2aac0c3d936cf8b16e4b96b512e09e7b15815bbfafa03275d81493465851a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page