question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using only the backlinks feature in existing RST prose

See original GitHub issue

Hi!

Firstly, thanks for the seemingly great package 😄 I see lots of successful libraries are using it to a great effect. And I intend to be your next user, especially once I write a bunch of python examples. For now though, I’d like to only use the awesome backlink feature to enhance my examples that are written inside existing RST prose.

Essentially, what I’m after is being able to write ordinary Sphinx RST like

Document
========
This is a document with the following example:

.. code:: python

    import lib

    lib.foo()
    b = lib.Bar()
    b.meth()

and have the links be generated regardless of the file’s location. It’s not obvious whether or not this is even possible since the documentation is so focused on the example gallery (which is hardly surprising 😅), but I suspect it is some combination of backreferences_dir, doc_module and reference_url as laid out in the few tutorials starting here. How could this be achieved?

Apologies for essentially asking the library to do something that it wasn’t necessarily supposed to do. So feel free to shut this down if you already know it won’t be possible. But I’m over the moon that this is even a thing! Keep making documentation great ❤️


Eventually having mini-galleries or just plain lists of example locations in reference documentation would be great too, but I think that’s too much for one user support question 😅 I might still be misunderstanding the features altogether.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
felix-hildencommented, Sep 23, 2021

I’ve recently implemented the functionality in a new Sphinx extension sphinx-codeautolink. As I said, the approach was different enough to warrant a new project in my opinion. Execution is fine for your gallery and actually should work much better in certain situations to determine references. But I went for static analysis instead for fewer assumptions and more flexibility. But I’d like to say thanks for the initial discussion! Your directions and source were very helpful when piecing together what should happen 👍 I’ll leave this open if you’d like to do something with it, or if you’d like to discuss something I’m all for it. But you can consider my use case satisfied.

1reaction
lucyleeowcommented, Jul 9, 2021

I think statically getting the backreferences is the tricky part. The tool should be able to work for code blocks regardless of whether the file it came from was .py or .rst -> i.e. it takes a code block and outputs backlined rst.

Whether we go from .py -> rST -> execute/get backreferences OR .py -> execute/get backreferences -> rST , would then be fairly trivial and a decision based on user need and backwards compatibility etc

You can take a look at [backreferences.py](https://github.com/sphinx-gallery/sphinx-gallery/blob/master/sphinx_gallery/backreferences.py) to get an idea of how it is done now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Backlink Monitoring: Keeping Track of Your Existing Links
Here's how to effectively keep track of your existing links. Also: the pros and cons of couple backlink monitoring tools.
Read more >
How to Use HARO (And Alternatives) to Get Killer Backlinks
Unlike most link building tactics, HARO (and alternatives) is excellent for generating high-quality backlinks and press mentions. Learn how.
Read more >
Backlink Monitoring: How to Easily Track Your Existing Links
It is important to monitor not only where links are coming from, but how different anchor text is distributed through your backlink profile....
Read more >
What Are Backlinks? How To Get Them In 2021 - FATJOE
A backlink is a hyperlink from a third-party website to yours. Google uses backlinks as a ranking signal to measure the validity, relevancy, ......
Read more >
A Beginner's Guide to Craft: Linking - The Sweet Setup
Plus, some popular features first debuted in Roam Research have made ... We're also going to look at how I use backlinks to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found