NiklasRosenstein / pydoc-markdown

Create Python API documentation in Markdown format.
http://niklasrosenstein.github.io/pydoc-markdown/
Other
453 stars 102 forks source link

In-document anchor link is incorrectly parsed as symbol #274

Closed liu2g closed 1 year ago

liu2g commented 1 year ago

Environment

Describe the bug

This is somehow related to #44, but in my particular use case, I would like to link to an anchor in the same document manually. Since the anchor is in the same document, it starts with # right away without /.

The context is to generate a markdown page then later append a custom block of text into the same file, such that they appear as one whole article in a wiki.

For example, if my module is mymodule and I have more text to dump at the end, I would do

pydoc-markdown -m mymodule > wikipage.md && cat more-text.md >> wikipage.md

In mymodule.py, there is

def foo():
    """
    Refer to [flowchart](#flowchart-of-foo)
    """

and in more-text.md, there is

# Flowchart of Foo
Here is a flowchart of foo

However, it generates below in the wikipage.md

Refer to [flowchart](`flowchart`-of-foo)

Expected behavior

The anchor should be correctly parsed such that [flowchart](#flowchart-of-foo) stays the same in the rendered markdown document

NiklasRosenstein commented 1 year ago

Thanks for reporting this issue @liu2z2 . Should be fixed in 614d076fb3d3130b99c80e96218fcfd95f6c0926