# Rustdoc suggestion: Highlight links \`fn\`s, \`mod\`s \`type\`s etc. appropriately within \`///\` and \`//!\` documentation

**URL:** <https://internals.rust-lang.org/t/rustdoc-suggestion-highlight-links-fn-s-mod-s-type-s-etc-appropriately-within-and-documentation/17931>\
**Category:** documentation\
**Created:** [December 7, 2022, 5:53pm UTC](https://internals.rust-lang.org/t/rustdoc-suggestion-highlight-links-fn-s-mod-s-type-s-etc-appropriately-within-and-documentation/17931 "2022-12-07T17:53:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeoniePhiline](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/leoniephiline/32/10250_2.png) [@LeoniePhiline](https://internals.rust-lang.org/u/LeoniePhiline)\
**Post date:** [December 7, 2022, 5:53pm UTC](https://internals.rust-lang.org/t/rustdoc-suggestion-highlight-links-fn-s-mod-s-type-s-etc-appropriately-within-and-documentation/17931/1 "2022-12-07T17:53:32Z")

</div>

While reading documentation, especially when discovering the API of a new crate, I got the impression that human readers could get an easier understanding of the referenced items if they were appropriately highlighted.

Currently, all links to other documented items within a `///` or `//!` block are rendered as yellow, the default link color `var(--link-color`)`.

In structured overviews, on the other hand, links to each item type get a specific CSS class like `mod`, `fn`, `macro`, `type`, `primitive` etc. assigned - causing these items to be colored distinctly according to their item type.

Applying the same highlighting in `///` and `//!` blocks would help human readers in disambiguating `fn`s from `mod`s from `macro`s and so on, without requiring all `fn`s to be suffixed by `()` and all `macro`s to be suffixed by `!` (which is neither enforced, nor even recommended as best practice). Suffixes are furthermore not available for disambiguation between modules and primitives.

Since rustdoc already gathers all information about the linked item (determining the target URL), implementation should be rather trivial.

If the feature is receiving interest, then I would try an implementation myself.

---

<div class="post-metadata">

**Author:** ![LeoniePhiline](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/leoniephiline/32/10250_2.png) [@LeoniePhiline](https://internals.rust-lang.org/u/LeoniePhiline)\
**Post date:** [January 20, 2023, 11:43pm UTC](https://internals.rust-lang.org/t/rustdoc-suggestion-highlight-links-fn-s-mod-s-type-s-etc-appropriately-within-and-documentation/17931/2 "2023-01-20T23:43:35Z")

</div>

There appears not to be very much interest. 🤔

---

<div class="post-metadata">

**Author:** ![notriddle](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/notriddle/32/14082_2.png) [@notriddle](https://internals.rust-lang.org/u/notriddle)\
**Post date:** [January 20, 2023, 11:45pm UTC](https://internals.rust-lang.org/t/rustdoc-suggestion-highlight-links-fn-s-mod-s-type-s-etc-appropriately-within-and-documentation/17931/3 "2023-01-20T23:45:07Z")

</div>

I actually think that's pretty reasonable, but I just didn't notice this.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [April 20, 2023, 11:45pm UTC](https://internals.rust-lang.org/t/rustdoc-suggestion-highlight-links-fn-s-mod-s-type-s-etc-appropriately-within-and-documentation/17931/4 "2023-04-20T23:45:26Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
