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

Sidebar columns are too narrow so variable and method names are cut in half #29

Closed
rec opened this issue Feb 13, 2019 · 7 comments

Comments

2 participants
@rec
Copy link

commented Feb 13, 2019

Expected Behavior

Variable names (e.g. class methods or members) that aren't "too long" should be displayed on one line

Actual Behavior

Variable names above 10 characters or so are split over two lines

Steps to Reproduce

  1. Open the pdoc documentation: https://pdoc3.github.io/pdoc/doc/pdoc/
  2. The variable instance_variables in Class is cut in half unless the window is extremely wide

Additional info

  • pdoc version: master
@rec

This comment has been minimized.

Copy link
Author

commented Feb 13, 2019

Thanks for this excellent package!

I'm reporting this first, and then I'm going to take a peek at coming up with a pull request.

My guess is that my solution will be a "single column sidebar" option that you can turn on but I haven't even looked at the code yet. :-)

@rec

This comment has been minimized.

Copy link
Author

commented Feb 13, 2019

Ah, so I haven't really even figured out where you render the sidebar and I'm out of time for this increment. Let me know if you have some hints as to how to proceed...

@kernc

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2019

This is the relevant template code. The heuristic is indeed very simple.

<%def name="show_column_list(items)">
<%
two_column = len(items) >= 6 and all(len(i.name) < 20 for i in items)
%>
<ul class="${'two-column' if two_column else ''}">
% for item in items:
<li><code>${link(item, item.name)}</code></li>
% endfor
</ul>
</%def>

Ideally, this would degrade gracefully via CSS, but I somewhat doubt it's possible with the current, column-count implementation.
#index .two-column {
column-count: 2;
}

@kernc kernc added the bug label Feb 13, 2019

@rec

This comment has been minimized.

Copy link
Author

commented Feb 13, 2019

Ah, very cool! So I could easily override this in my own template, and I will.

It might be... that this is supposed to be a really simple dox generator, that "one column mode always" might be the best for 95% of the world, and the other 5% can override column_count in their own templates? :-)

@kernc

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2019

I like the two-column mode on wide screens. I'd rather consider an alternative CSS implementation, such as two separate lists floated left or additional CSS media queries. 🤔

@rec

This comment has been minimized.

Copy link
Author

commented Feb 14, 2019

@kernc

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2019

The problem with overridden templates is maintaining them. Even as the API is mostly stable and shouldn't break customized templates in the near future, you're on your own merging in any likely forthcoming improvements.


As an alternative, care to test PR #31 and see if it works well with your project on various zoom / browser width levels?

@kernc kernc closed this in #31 Feb 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.