Skip to main content

reStructuredText custom role to add ref to PyPI.

Project description

reStructuredText custom role to refer PyPI packages.

Description

This is python package to provide features to refer to PyPI in docutils (and more).

Included features:

  • reStructuredText role

  • Sphinx extension

Installation

pip install rst-pypi-ref

Usage

When you write :pypi:`rst-pypi-ref` into reStructuredText source, this appends ref to PyPI URL for rst-pypi-ref.

Supporting syntax

  • Package name only: :pypi:`rst-pypi-ref`

  • Explicit version: :pypi:`rst-pypi-ref==0.2.0`

  • Change display text: :pypi:`PyPI Link <rst-pypi-ref>`

    • There package name in between < and >.

Simple usage

$ echo ':pypi:`rst-pypi-ref`' | python -m rst_pypi_ref.cli
<document source="<stdin>">
    <paragraph>
        <reference refuri="https://pypi.org/project/rst-pypi-ref">
            rst-pypi-ref

With Sphinx

extensions = [
    "rst_pypi_ref.sphinx",
]

For other docutils app

In entrypoint (before parse reST source), Call rst_pypi_ref.core.bootstrap.

from rst_pypi_ref.core import bootstrap

bootstrap()

Contibuting

See CONTIBUTING note.

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

rst_pypi_ref-0.4.0.tar.gz (13.6 kB view hashes)

Uploaded Source

Built Distribution

rst_pypi_ref-0.4.0-py3-none-any.whl (8.0 kB view hashes)

Uploaded Python 3

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