Skip to content

Allow controlling text of documentation link. #4207

@lrhn

Description

@lrhn

If you write [Foo.bar], you link to Foo.bar and the link text is Foo.bar.

There is no way to link to Foo.bar with a text of, fx, Foo.current.bar. Or anything else.

Currently if you write, as I did: [`Platform.current.nativePlatform`][Platform.nativePlatform],
the link does link to the documentation for Platform.nativePlatform, but the text is still Platform.nativePlatform too.

I don't know where the link text went. It's not in the output at all.
I'm pretty sure this is actually a bug, because DartDoc tries to not intercept Markdown reference-style links ([text][reference]) like:

The [banana][Bananas] is fine.

[Bananas]: http://example.com/bananas "example of bananas"

so it should have ignored the [Platform.nativePlatform].

It would be nice if it had actually worked. When DartDoc sees a markdown reference-style link, and it cannot find the target for the link (no Platform.nativePlatform link target defined in the document) then DartDoc should take over and try to interpret it as a doc element link.
It would let you make nice links to any documentable element, with full control over the link text.

Then a normal dartdoc link like [Platform.nativePlatform] is just short for [`Platform.nativePlatform`][Platform.nativePlatform].

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-enhancementA request for a change that isn't a bug

    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