Skip to content
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

how to customize titles of the generated pages ? #427

Closed
12rambau opened this issue Mar 27, 2024 · 3 comments
Closed

how to customize titles of the generated pages ? #427

12rambau opened this issue Mar 27, 2024 · 3 comments
Labels
Enhancement Good First Issue Good issue for first time contributors

Comments

@12rambau
Copy link

I'm using sphinx-autoapi to build my documentation and specifically the release 3.1.0a3 to build every method of my classes on a specific page: https://geetools.readthedocs.io/en/latest/autoapi/index.html

The problem is that now the titles are way too long to be displayed on a single line and "pre" tags in my html build don't wrap as normal text.

image

I would like to display them as pure h1 as in the pandas documentation to ensure they behave as normal text.

image

I assume I need to modify a template but I didn't understand which one and where to store it when reading your documentation

@AWhetter
Copy link
Collaborator

Thanks for trying out an alpha build and providing your feedback!
I actually think that it's not great that we use the fully qualified domain name in headings for anything other than modules. It creates too much redundancy, other than maybe in projects where there's very little nesting (like with pandas).
So I instead propose that we use the name of the entity as the heading, rather than the fully qualified name.

As for "pre" tags, I've always been on the fence about whether I like the look of the monospaced headings, both on the page and in the side bar. The links that it outputs aren't really useful and, as you say, it comes at the cost of not wrapping. So I'd be up for removing that too.

@AWhetter AWhetter added Enhancement Good First Issue Good issue for first time contributors labels Mar 28, 2024
@12rambau
Copy link
Author

So you are even suggesting to change the default template ?
I'm happy with that but I think I should wait for #399 to be merged to avoid polluting too much an already complex PR.

In the meantime could you advise on the process I should follow to update the templates ?
I'll make an edition to the documentation.

My guess is that I should override these files: https://github.com/ansys/sphinx-autoapi/blob/feat/single-page-option/autoapi/templates/python/class.rst

but I don't know where to store then in my build.

Also I see the the title of the template is just a regular title with "====": https://github.com/ansys/sphinx-autoapi/blob/feat/single-page-option/autoapi/templates/python/method.rst so where is the "pre" tag coming from ?

@AWhetter
Copy link
Collaborator

Documentation on editing the templates is here: https://sphinx-autoapi.readthedocs.io/en/latest/how_to.html#how-to-customise-layout-through-templates
They can be stored anywhere. But usually you would store them in a directory next to your conf.py file called something like _templates.

v3.1.0a3 isn't using that branch. It's using :py:meth:: https://github.com/readthedocs/sphinx-autoapi/blob/v3.1.0a3/autoapi/templates/python/method.rst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Good First Issue Good issue for first time contributors
Projects
None yet
Development

No branches or pull requests

2 participants