Skip to content

Anchor links in generated markdown are not unique #300

Closed
@danielparks

Description

@danielparks

Describe the Bug

The anchor names in markdown generated documentation for a module are not unique. This is a particular problem for attributes such as ensure. Each attribute with the same name is given the same anchor link name, which breaks linking.

For example, see the docs for my rustup defined type. The ensure attribute links to #ensure, but the browser (Safari, in my case) can’t distinguish between the ensure attribute for the rustup::global class and the rustup defined type.

You can also conflicting anchor names for types as well, since it just ignores characters like :.

Expected Behavior

All anchor names should be unique.

Steps to Reproduce

❯ cat >test.pp     
# @summary test::ab class
# @param ensure attribute on test::ab
class test::ab ( $ensure ) {
}

# @summary test::a::b class
# @param ensure attribute on test::a::b
class test::a::b ( $ensure ) {
}
^D
❯ puppet strings generate --format markdown test.pp >/dev/null
❯ fgrep name= REFERENCE.md                                
### <a name="testab"></a>`test::a::b`
##### <a name="ensure"></a>`ensure`
### <a name="testab"></a>`test::ab`
##### <a name="ensure"></a>`ensure`

Environment

  • Puppet 7.19.0 (installed from brew)
  • pdk 2.5.0.0(installed from brew)
  • macOS 12.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions