kai687 / sphinxawesome-theme

Create beautiful and awesome websites with the Sphinx documentation generator.
https://sphinxawesome.xyz
MIT License
109 stars 25 forks source link

is syntax highlighting supported? #1778

Closed theaddonn closed 6 months ago

theaddonn commented 6 months ago

first up, this theme is amazing!

secondly, I am trying to bring some code into our docs..

image

this just looks a bit sad, does sphinxawesome support colorful syntax highlighting?

this is my current code:

.. highlight:: python
    :linenothreshold: 1
    :force:

.. code-block:: python

    def hello(x) {
        print(x)
    }

    def main() {
        hello("deez nuts")
    }
kai687 commented 6 months ago

You find it sad, I find it exactly to my liking :)

I haven't found 1 theme that's as readable in light and dark mode, and with all code highlighting options (emphasizing lines for example). Colors are hard :)

There's 1 open issue to support different highlighting styles for light and dark mode #1727, so for now, you can only choose one theme for both light and dark.

You should be able to add pygments_style = "STYLE" to your Sphinx configuration file conf.py. Replace "STYLE" with one of the Pygments styles.

I haven't tested this though and don't know if that will even work.

theaddonn commented 6 months ago

it works great.. but yeah you are right:

YAY image

Booooo

image

Good to see that there already is an issue fo that.. Hope we can use it soon

Thanks for your time and have a great day!

theaddonn commented 6 months ago

this is prolly not needed anymore

kai687 commented 6 months ago

@Adrian8115 you might be able to tweak the background color in one of the themes with custom CSS. IMO even if you're on light mode, the code snippets can be dark (light syntax highlighting schemes seem to be harder to make readable with enough contrast etc.). Maybe that might work as a workaround.