Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support Tagging examples #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Cadair opened this issue Jun 29, 2017 · 11 comments
Closed

Support Tagging examples #261

Cadair opened this issue Jun 29, 2017 · 11 comments

Comments

@Cadair
Copy link
Contributor

Cadair commented Jun 29, 2017

It would be nice to be able to have some kind of categories that examples in multiple sections could be assigned to (i.e. all these examples use one subpackage).

sunpy/sunpy#2164

@Titan-C
Copy link
Member

Titan-C commented Jun 29, 2017

Could you elaborate on the idea. I'm not sure what you are asking nor I understand from the issue in sunpy.

  • Tagging is a feature you can add yourself with a custom sphinx directive, or the index directive, see: https://stackoverflow.com/questions/18146107/how-to-add-blog-style-tags-in-restructuredtext-with-sphinx
    Just use that syntax in the docstring of the examples, or the comment blocks. Sphinx should take care
    I don't think we should ship this as a feature in Sphinx-Gallery. Though we can document a link to it or any good implementation you provide
  • You want to sort the subsections of a gallery, matplotlib style? It can be done naming the folders alphabetically and a sort key is being worked on [MRG] Other gallery subsection sorter #234 . To get the table of contents at the beginning include the toctree directive in the readme.txt
  • You what to group examples using a specific function. Done with backreferences https://readthedocs.org/projects/sphinx-gallery/builds/5627339/
  • You whant to group at module or submodule level? That would require a complex re-implementation of the back-references to build those custom subgalleries. I don't see that happening soon, but PR's are welcome

@larsoner
Copy link
Contributor

In some sense #205 could be made to take care of this using backreferences.

@story645
Copy link
Contributor

story645 commented Sep 8, 2020

@Titan-C can you elaborate a bit on the tagging? For example, I'd love to push for tags to be integrated into https://matplotlib.org/gallery/ in a way that the tags can be searched & all examples w/ a given tag surfaced.

@larsoner
Copy link
Contributor

larsoner commented Sep 8, 2020

@story645 did you look at the first suggestion?

https://stackoverflow.com/questions/18146107/how-to-add-blog-style-tags-in-restructuredtext-with-sphinx

You can use either of these solutions to tag/index examples just by adding RST to the example text somewhere (probably beneath the description paragraph? Or maybe right under the title if we properly support ignoring ..-starting lines when looking for the description paragraph)

@story645
Copy link
Contributor

story645 commented Sep 8, 2020

I did, but I'm not sure how to go from that to on the fly galleries of examples w/ the same tag.

@lucyleeow
Copy link
Contributor

lucyleeow commented Sep 14, 2020

@story645 Is the index answer (https://stackoverflow.com/a/19837140) a reasonable solution for you?

@melissawm
Copy link
Contributor

Hi folks - I have created a small Sphinx extension to do this. Feel free to give feedback or ask for features. Thanks!

https://github.com/melissawm/sphinx-tags

@larsoner
Copy link
Contributor

Awesome, thanks @melissawm !

FWIW if you'd rather have that repo live under an org account at some point rather than your personal one, I'm happy to help move that repo over to sphinx-gallery's org if you think it's a good fit, and give you appropriate permissions, etc.

Closing as fixed by sphinx-tags extension rather than SG

@melissawm
Copy link
Contributor

@larsoner about that 😄 I just cut a release that I think makes sphinx-tags usable: https://github.com/melissawm/sphinx-tags

If you think this fits sphinx-gallery I'm happy to move - it would give the project more visibility and I'd love to help support sphinx-gallery, too. Cheers!

@larsoner
Copy link
Contributor

@lucyleeow WDYT?

@lucyleeow
Copy link
Contributor

Sounds great to me! I would maybe just suggest to make it clear that the tags work on all documentation pages, not just gallery examples?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants