pdoc3 / pdoc

:snake: :arrow_right: :scroll: Auto-generate API documentation for Python projects
https://pdoc3.github.io/pdoc/
GNU Affero General Public License v3.0
1.12k stars 145 forks source link

WIP: Added theming and dark mode support per #152. #341

Closed pm5k closed 2 years ago

pm5k commented 3 years ago

Abstract

As per https://github.com/pdoc3/pdoc/issues/152 -- added support for easy theming and dark-mode.

Changelog

Demo from issue comment

pdoc3_dm_demo_01 (1) pdoc3_dm_demo_02

pm5k commented 3 years ago

@kernc

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

davfsa commented 3 years ago

@pm5k Just wanted to drop in and say, amazing work. It looks splendid :heart: Thank you for working on this

pm5k commented 3 years ago

@davfsa

@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. :)

sla-te commented 3 years ago

If we set hljs_style_tuple = ('atom-one-dark', 'github'), we will get dark code highlighting and light pages - wanted to put dark mode to default and found that out.

pm5k commented 3 years ago

If we set hljs_style_tuple = ('atom-one-dark', 'github'), we will get dark code highlighting and light pages - wanted to put dark mode to default and found that out.

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.