Skip to main content

MdPages - Markdown Pages

Mdpages is a simple Django app to generate pages from Markdown files.

Pages also can have a Table of Content automatically generated based on headings.

Quick start

Supposing you want to create an About page, having the markdown file at /pages/content/about.md.

  1. Add “mdpages” to your INSTALLED_APPS setting like this:

INSTALLED_APPS = [
        ...
        'mdpages',
]
  1. Set the location of the directory that will contain the Markdown files in settings with MDPAGES_CONTENT_DIR:

MDPAGES_CONTENT_DIR = '{}/pages/content/'.format(BASE_DIR)
  1. Add the template that will contain the Markdown generated content, you will have two variables available: body and toc (for the table of contents), for example create a template /templates/mdpages/page.html with contents like:

{% extends "base.html" %}

{% block title %}{{title}}{%endblock%}
{% block description %}{{description}}{%endblock%}

{% block content %}
<div class="container">
     {{ toc|safe }}
     <hr>
     {{ body|safe }}
</div>
{% endblock %}

And add the template path to settings MDPAGES_TEMPLATE_NAME:

MDPAGES_TEMPLATE_NAME = 'mdpages/page.html'
  1. Create a view using staticages.views.MdPageView specifying the name of the Markdown file md_file and the template_name:

from mdpages.views import MdPageView

class AboutView(MdPageView):
        md_file = 'language-learning.md'

        # any kind of extra content used in your template
        extra_context = {
                'title': 'About page',
                'description': 'This is the about page of the site.'
        }
  1. Use it in your urls.py:

from .views import AboutView

urlpatterns = [
        path('about', AboutView.as_view()),
]

Reference

Metadata

Release files for django-mdpages 0.2

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

Source distribution (sdist)

Source distribution for django-mdpages 0.2
File Size Uploaded Provenance Actions
django-mdpages-0.2.tar.gz 3.8 kB Without provenance Details for django-mdpages-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-mdpages 0.2
File Interpreter ABI Platform Actions
django_mdpages-0.2-py3-none-any.whl Python 3 none any Details for django_mdpages-0.2-py3-none-any.whl

Total release size: 8.0 kB

Release files / django-mdpages-0.2.tar.gz

Download URL django-mdpages-0.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c01cd523cce3b34c2b24e1344f4391a8708aa4efe4e17042438bdea7d327b262
BLAKE2b-256 checksum
How to use checksums
b18e56be8c66d188f6f5c1aae96b5d406f17d31c20c0f46c96dceb0c43763080
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Release files / django_mdpages-0.2-py3-none-any.whl

Download URL django_mdpages-0.2-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4448b370b8059d8e7d80a5752418e902b5b93052713f8037c395c53c1c79fcc0
BLAKE2b-256 checksum
How to use checksums
048727a6839db31fc9b74c7f4d4e941c93321e2e9b51771ee904e5a39c4dff62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Security for django-mdpages 0.2

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.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

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