Skip to main content

Include Python source code in Markdown files

Project description

Include Python source code in Markdown files

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 tests/example.py, add the following lines in a code block:

-->includepy<-- tests/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

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.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: includepy-0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 43e438ed02f32c539cca4b6c7ac6f5d9d62f1468683ad5fec8eef15ed83f8203
MD5 ad0c5afd30c41ddb5da68fd53236bebd
BLAKE2b-256 858f6b199eee57b042670e5ec755edf4f5c5dab564e92d09124ba97f4ae7c314

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