Skip to content

bug: External cross-references are rendered as links to nowhere #4

@jayqi

Description

@jayqi

Description of the bug

All type annotations for any types get generated as hyperlinks with header ID fragments, but the links for types that are external to the package don't go to real header in the document. This is confusing because these appear as hyperlinks that don't do anything.

To Reproduce

This docstring:

def read_version_from_pyproject_toml(path: Path) -> Version:
    """Read the version from a pyproject.toml file. Requires the version to be statically defined.

    Args:
        path (Path): The path to the pyproject.toml file, or the directory containing it.

    Returns:
        (packaging.version.Version): The version read from the file.
    """

produces this output:

### vspect.read_version_from_pyproject_toml

```python
read_version_from_pyproject_toml(path)
```

Read the version from a pyproject.toml file. Requires the version to be statically defined.

**Parameters:**

- **path** (<code>[Path](#pathlib.Path)</code>) – The path to the pyproject.toml file, or the directory containing it.

**Returns:**

- <code>[Version](#packaging.version.Version)</code> – The version read from the file.

The hyperlinks [Path](#pathlib.Path) and [Version](#packaging.version.Version) don't link to real headers in the document. (The extraneous periods as reported in #3 notwithstanding.)

Full output

Expected behavior

External type annotations should not be hyperlinks.

A nice-to-have would be to link to external documentation.

Environment information

  • System: macOS-14.7.2-x86_64-i386-64bit-Mach-O
  • Python: cpython 3.13.0 (/Users/jqi/vspect/.venv/bin/python3)
  • Environment variables:
  • Installed packages:
    • griffe2md v1.1.0

Metadata

Metadata

Assignees

Labels

featureNew feature or requestinsidersCandidate for Insiders

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions