Skip to content

Heading with file path text generate nested <a> tags and result in broken link #1635

@kshinya7

Description

@kshinya7

When a heading contains text that matches a documented file path the cross reference system wraps the text in a link inside the header's own anchor link, producing invalid nested tags.

If i have a structure like these two files:

  • lib/pathname.rb:
class Pathname
end
  • maintainers.md:
# Maintainers
#### lib/pathname.rb

Then when generating the docs with rdoc --all lib/pathname.rb maintainers.md it generates the html of maintainers_md.html like this:

<h4 id="libpathnamerb">
  <a href="#libpathnamerb"><a href="lib/pathname_rb.html">lib/pathname.rb</a></a>
</h4>

which in the browser the heading ends up with only the inner tag, so clicking it navigates to the file's supposed doc page (which doesn't exist) instead of anchoring.

I think the correct behaviour is for the header to render as a plain anchor without referencing the actual file, because the purpose of a header is to label the section. I also saw this on the maintainers page on ruby docs that had this problem and clicking on a header like lib/pathname.rb goes into a 404.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions