New :searchfox: role in source documentation

21 views
Skip to first unread message

Andrew Halberstadt

unread,
Jul 20, 2022, 9:32:40 AM7/20/22
to dev-platform, Firefox Dev
Hey everyone!

When writing docs (for firefox-source-docs specifically), you may often find yourself wanting to link to Searchfox. A new role 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:

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 for a hint.

Cheers,
Andrew

Andrew Halberstadt

unread,
Jul 20, 2022, 10:16:53 AM7/20/22
to Gijs Kruitbosch, dev-platform, Firefox Dev
I was mostly scratching an itch while working through some doc changes myself, so "planning" is a strong word. But those are good points and I've filed some bugs for both ideas:

Thanks!
- Andrew

On Wed, Jul 20, 2022 at 9:42 AM Gijs Kruitbosch <gijskru...@gmail.com> wrote:

Are we planning on doing some kind of automation that flags when linked files disappear to ensure the documentation doesn't have dead links?

Until now, when linking to searchfox, I've used permalinks to avoid that happening - but of course those gradually become old and more and more disconnected from current reality. Can the searchfox role create such permalinks?

~ Gijs

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

Chris H-C

unread,
Jul 20, 2022, 2:36:10 PM7/20/22
to Andrew Halberstadt, Gijs Kruitbosch, dev-platform, Firefox Dev
For those using MyST to write docs in the tree in markdown, the syntax[1] is

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

I just added some docs using this and can confirm it works[2].

:chutten


Reply all
Reply to author
Forward
0 new messages