Hey everyone!

When writing docs (for firefox-source-docs
<https://firefox-source-docs.mozilla.org/> specifically), you may often
find yourself wanting to link to Searchfox. A new role
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>
just landed which makes this a bit simpler. It can be used like so:

    See :searchfox:`here <devtools/client/definitions.js>` and
:searchfox:`devtools/client/dom`.

The first role will create a link with the text `here`, and the second will
create a link with the text `devtools/client/dom`. In both cases, they link
to `https://searchfox.org/mozilla-central/source/<path>`.

You can also link to a separate tree on Searchfox like so:

    :searchfox:`here <mozilla-release:devtools/client/definitions.js>`

Here's an example of the role being used in the wild:
https://searchfox.org/mozilla-central/source/docs/code-quality/lint/linters/clang-format.rst#20

If you'd like to create a similar role (e.g to link to Bugzilla), it's
pretty easy to do! See the implementation of the searchfox role
<https://searchfox.org/mozilla-central/source/python/mozbuild/mozbuild/sphinx.py#198>
for a hint.

Cheers,
Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CAAJAz%2B6q9%2BT6Q6U4%3DN5utSONd5MekwprK475sWkxccsoH0MC9g%40mail.gmail.com.

Reply via email to