-
-
Notifications
You must be signed in to change notification settings - Fork 144
WIP: Added theming and dark mode support per #152. #341
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
Conversation
Do let me know what your thoughts are regarding this. Additionally, following contribution guidelines, I ran flake8 and unittest, while flake8 came up with nothing, unit test had one failing test even before my change: Traceback (most recent call last):
File "/home/tom/pdoc/pdoc/test/__init__.py", line 100, in wrapper
func(*args, **kwargs)
File "/home/tom/pdoc/pdoc/test/__init__.py", line 1039, in test_Class_params
self.assertEqual(pdoc.Class('G2', mod, G2).params(), ['*args', '**kwds'])
AssertionError: Lists differ: [] != ['*args', '**kwds']
Second list contains 2 additional elements.
First extra element 0:
'*args'
- []
+ ['*args', '**kwds'] Unsure if relevant, but thought I'd mention. Would also be good to know if more changes are needed and get general feedback on this. Thanks |
@@ -434,7 +517,7 @@ | |||
|
|||
<footer id="footer"> | |||
<%include file="credits.mako"/> | |||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> ${pdoc.__version__}</a>.</p> | |||
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> ${pdoc.__version__}</a>.</p> |
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.
Will have to revert this, the copy-over must've blasted it..
@@ -11,7 +11,7 @@ | |||
return name | |||
url = dobj.url(relative_to=module, link_prefix=link_prefix, | |||
top_ancestor=not show_inherited_members) | |||
return f'<a title="{dobj.refname}" href="{url}">{name}</a>' | |||
return '<a title="{}" href="{}">{}</a>'.format(dobj.refname, url, name) |
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.
Will have to revert this, the copy-over must've blasted it..
|
||
const changeHLJS = (style) => { | ||
const hljsStyle = document.querySelector("#hljs"); | ||
const styleURL = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/" + style + ".min.css"; |
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.
Could probably do with making this a parameter/config value tbh..
@pm5k Just wanted to drop in and say, amazing work. It looks splendid ❤️ Thank you for working on this |
Thank you. I sort of left it here until I get a green light from someone. There’s a few changes to be made, but ultimately it would be nice to know whether there is a chance for this to get merged so I can just wrap this up. Of course it would also be good to get some critique from the author of the project as ultimately this would have to fit with their vision for pdoc. Glad you liked it though. :) |
If we set |
That’s purely because the first item is light and the second is dark. In order to set dark mode as default you would have to either swap the vars in the theme or I would have to expose that as an option. Right now it works in such a way that dark mode can only be set as default by toggling it once in the doc switch once rendered out. Good catch though. I will add it in at some point. |
Abstract
As per #152 -- added support for easy theming and dark-mode.
Changelog
themes
folder inside oftemplates/
so there's a place for any number of user or maintainer-generated theme files.default.mako
theme alongside of a blankcustom.mako
theme. The user should probably use the custom file if they wish to add their own theme, or alternatively they can copy the default one, rename it and adjust settings therein.css.mako
todefault.mako
so these can be built by the template renderer independently.html.mako
.hljs
config parameter to now be a tuple of strings, where the first islight-mode
and second isdark-mode
, this gets loaded accordingly to the previously mentioned toggles to keep hljs blocks consistent with overall theme.default.mako
..content
as it was wasting real-estate.hljs
code blocks as the extra padding was not needed.Demo from issue comment