cpitclaudel / alectryon

A collection of tools for writing technical documents that mix Coq code and prose.
MIT License
227 stars 36 forks source link

[question] pygments style #58

Closed gares closed 3 years ago

gares commented 3 years ago

This comment seems outdated, since the .css is not inlined even if you use the command line interface.

def highlight_html(coqstr):
    """Highlight a Coq string `coqstr`.

    Return a raw HTML string.  This function is just a convenience wrapper
    around Pygments' machinery, using a custom Coq lexer and a custom style.

    The generated code needs to be paired with a Pygments stylesheet, which can
    be generated by running the ``regen_tango_subtle_css.py`` script in the
    ``etc/`` folder of the Alectryon distribution.

    If you use Alectryon's command line interface directly, you won't have to
    jump through that last hoop: it renders and writes out the HTML for you,
    with the appropriate CSS inlined.  It might be instructive to consult the
    implementation of ``alectryon.cli.dump_html_standalone`` to see how the CLI
    does it."""

If it was inlined, I could add a command line option to select another style.

I'd like to pick another style, one close to the default vscode one.

One way would be to keep the css external, maybe rename it to remove "tango", and change the regen_tango_subtle_css.py to take an argument (the style), and the let me generate another style at deploy time.

Another option would be to make this comment true, and add a command line option to pick the style.

What is best?

cpitclaudel commented 3 years ago

I think Github lost my answer to this question, sorry. Trying again:

This comment seems outdated, since the .css is not inlined even if you use the command line interface.

It depends:

If it was inlined, I could add a command line option to select another style.

We could still have a CLI option to select the style, even if it's external (I think this is also what you say below?)

One way would be to keep the css external, maybe rename it to remove "tango", and change the regen_tango_subtle_css.py to take an argument (the style), and the let me generate another style at deploy time.

Right.

Another option would be to make this comment true, and add a command line option to pick the style.

Right.

What is best?

I'm not sure :) Both? I've made a branch at https://github.com/cpitclaudel/alectryon/tree/gh-58-pygments ; please give it a try and let me know what you think. In brief:

Hopefully that covers everything. Please let me know, and I'll merge soon.

gares commented 3 years ago

great, I'll try asap

gares commented 3 years ago

Works for me, thanks!

cpitclaudel commented 3 years ago

Thanks, merged.