Skip to main content

Include Python source code in Markdown files

Project description

Include Python source code in Markdown files

Latest version Documentation MIT license

The includepy package provides a Markdown preprocessor that allows you to include the source code for a specific Python object (e.g., a function or class) when rendering Markdown content.

For example, to include the source code for the factorial function in example.py, add the following lines in a code block:

-->includepy<-- example.py
-->pyobject<-- factorial

The includepy preprocessor will turn this into the following:

def factorial(n: int) -> int:
    value = n  # (1)
    while n > 1:
        n -= 1
        value *= n
    return value

See the documentation for further details.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

includepy-0.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file includepy-0.2-py3-none-any.whl.

File metadata

  • Download URL: includepy-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for includepy-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f522db4e28eae66343d0ee7134e18418762c1da34b1d442a2aee11d3f60323a
MD5 c0396abfb7d577564761ba7e44f6d134
BLAKE2b-256 d7f9ca273d48850bac04ae8faf305b2ba39be19683645feb92290b310d5df7fa

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