-
Notifications
You must be signed in to change notification settings - Fork 13
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
added alphabetic sorting and tag naming configuration #27
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome, thank you so much! Only a very minor comment otherwise looks great.
Let me know if you'd like to stick around and contribute more :) Cheers!
src/sphinx_tags/__init__.py
Outdated
@@ -28,7 +28,7 @@ class TagLinks(SphinxDirective): | |||
|
|||
# Custom attributes | |||
separator = "," | |||
intro_text = "Tags: " | |||
intro_text = "In categories: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably be configured as well, I guess. We can do this in a follow-up though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, makes sense! What should we call it in the config? Something like tags_intro_text
maybe?
Edit: I'm trying to do it, but I don't understand what it actually does, as in: where does this text appear in the generated document OK got it :D
src/sphinx_tags/__init__.py
Outdated
content.append("") | ||
content.append("```{toctree}") | ||
content.append("---") | ||
content.append("--------") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is actually unnecessary; the syntax for MyST is actually for this separator to match the one on line 105 below, so it should be just 3 dashes as originally.
content.append("--------") | |
content.append("---") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha! :)
Sure, I'm happy to contribute if I can! This extension really helped me and I will definitely use it, so if I can make it even better, that would be great :) |
I might have made some mess with the commits, do you want me to do them as a separate branch? Or can you approve/merge like this? |
Also removes files from tag folder before (re)creating them.
a28104e
to
a94b81e
Compare
Also adds the tags output dir to .gitignore for convenience, and fixes a typo.
Ok I think this is good to go! My last comment is that usually to keep features isolated from the main branch, it is a good idea to create a feature branch when you want to submit a PR. I'll cut a release with these changes right now. Thanks again 🎉 |
Hi there!
I am using Sphinx to create some documentation at work, and after searching for a tagging solution I found your fantastic extension!
As I basically want to only use tags (or categories) as my index, I tried to make it easier to customize them. So now there are three additional settings in the
conf.py
:tags_page_title
: this is the wording on top of a tag page, I call it "Category", the default is "Tag"tags_page_header
: this is what appears before the tags, the default is "With this tag", in my case "In this category"tags_index_head
: the title/header of thetoctree
in the tags index file that Sphinx generates.On top of that I also added alphabetic sorting of the tags, both in the tag index and in each tag page. As for the latter, it is not perfect: as it goes by file name, if your article/post/paragraph is "An interesting story" but the actual file name is "zorro_returns.md", then of course it won't work as expected. A solution to this would require some RegEx, I suppose.
I would assume that the alphabetic sorting should be the default behavior, but maybe it should be a flag instead? What do you think?
Anyway, I'm curious to find out what you think about this proposal! I went ahead and added it also to the documentation.
Thanks again for making this fantastic extension!