Skip to main content

This is an extension to Python-Markdown which provides an "include" function, similar to that found in LaTeX (and also the C pre-processor and Fortran). I originally wrote it for my FORD Fortran auto-documentation generator.

Project description

This is an extension to Python-Markdown which provides an “include” function, similar to that found in LaTeX (and also the C pre-processor and Fortran). I originally wrote it for my FORD Fortran auto-documentation generator.

Installation

This module can now be installed using pip.

pip install markdown-include

Usage

This module can be used in a program in the following way:

import markdown
html = markdown.markdown(source, extensions=[markdown_include.include'])

The syntax for use within your Markdown files is {!filename!}. This statement will be replaced by the contents of filename. Markdown-Include will work recursively, so any included files within filename wil also be included. This replacement is done prior to any other Markdown processing, so any Markdown syntax that you want can be used within your included files. Note that this is a change from the previous version. It was felt that this syntax was less likely to conflict with any code fragments present in the Markdown.

By default, all file-names are evaluated relative to the location from which Markdown is being called. If you would like to change the directory relative to which paths are evaluated, then this can be done by specifying the extension setting base_path.

import markdown
from markdown_include.include import MarkdownInclude

# Markdown Extensions
markdown_include = MarkdownInclude(
    configs={'base_path':'/srv/content/', 'encoding': 'iso-8859-1'}
)
html = markdown.markdown(source, extensions=[markdown_include])

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

tiangolo-markdown-include-0.7.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tiangolo_markdown_include-0.7.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file tiangolo-markdown-include-0.7.0.tar.gz.

File metadata

  • Download URL: tiangolo-markdown-include-0.7.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.0 pkginfo/1.7.0 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.8.0 tqdm/4.40.0 CPython/3.6.9

File hashes

Hashes for tiangolo-markdown-include-0.7.0.tar.gz
Algorithm Hash digest
SHA256 db41146a27debd028cf38b79ef46d39b6ef0e00abd9d49cf4e217c81025a522b
MD5 d0417b051ce7f2c9b06fd6b2d8583fe7
BLAKE2b-256 efd041c202180dfbf3ed481f1098a54c54d2e92c3f6460b37f5c47ad5fd492e1

See more details on using hashes here.

File details

Details for the file tiangolo_markdown_include-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: tiangolo_markdown_include-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.0 pkginfo/1.7.0 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.8.0 tqdm/4.40.0 CPython/3.6.9

File hashes

Hashes for tiangolo_markdown_include-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9471ff0f72fc331db20a3d1410e6a6b80706ca0d95acb5562dbd82e5d6bb9a83
MD5 c296b66b743a6f42a8c0ac27b22ea313
BLAKE2b-256 df3b43890074c0deb1e8d3ac646bcb7b5901d6aca5173a26954fb9a426fe9df0

See more details on using hashes here.

Supported by

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