Have rustdoc create hyperlinks on items in compiled code examples

609059a
Opened by Manish Goregaokar at 2022-01-18 22:11:02

Currently we just generate HTML for the code examples by compiling markdown.

However, rustdoc could compile these examples with a plugin that emits resolved path information for each ExprPath and import being used. This part isn't too hard. Might actually be useful as a plugin to be run on independent rust programs.

Then, we need to tweak the syntax highlighting bits so that these paths (those with a known span, that is), get linked appropriately.

cc @alexcrichton @steveklabnik

  1. I believe we have a bug open for this already? It's been this way for so long, we have to have had...

    Steve Klabnik at 2015-10-10 21:15:47

  2. This is basically just DXR in rustdoc

    Alex Crichton at 2015-10-11 17:11:22

  3. Yeah, we realized that after discussing a bit.

    Manish Goregaokar at 2015-10-11 18:38:30

  4. So is this issue still open then? Or is it a duplicate?

    Matt Gambogi at 2016-01-07 19:10:42

  5. I don't think so, but DXR exists which gives a similar code search (just not in rustdoc examples). Not sure if this is worth pursuing.

    Manish Goregaokar at 2016-01-08 14:50:50

  6. Triage: no change

    Steve Klabnik at 2019-12-25 16:22:15