Skip to main content

Pygments Ashen

This repository contains the Pygments style plugin for the Ashen theme. Available as the pygments-ashen package on PyPI for use in your Python projects, or with the Pygments CLI tool. The actual name of the style within pygments is ashen.

How To Use

The following shows how to use the style with uv, which is currently the cleanest way to manage Python projects and libraries. You may, of course, install the package into a virtual environment with pip, if you wish:

pip install pygments-ashen

Pygments CLI

Third-party Pygments styles are Python packages that must be available in the environment pygments is running in. For example, you can use uv to create a one-off environment for a single command:

uv run --with 'pygments-ashen,pygments' \
pygmentize -O full,style=ashen \
-l python -f html foobar.py > foobar.html

The above command invokes pygmentize with the pygments-ashen and pygments dependencies available, and renders the file foobar.py in HTML format with the Ashen theme applied.

In Your Projects

If your project uses Pygments for code highlighting, you can easily add support for Ashen. The pygments-ashen package must be installed in the project environment:

uv add pygments-ashen

Then, you can use ashen as the style in Pygments formatters. Here's an example from Zona. This code renders a Markdown code block in HTML with Ashen highlighting, using the marko library:

# method part of subclass of marko.html_renderer.HTMLRenderer
@override
def render_fenced_code(self, element: FencedCode):
    # pygments expects a single string, not a list of lines
    code = "".join(child.children for child in element.children)
    # fallback to "text" if no language specified
    lang = element.lang or "text"

    # load the correct pygments lexer
    try:
        lexer = get_lexer_by_name(lang, stripall=False)
    except Exception:
        lexer = TextLexer(stripall=False)

    # use the "ashen" style, requires pygments-ashen package
    formatter = HtmlFormatter(style="ashen", nowrap=True, noclasses=True)
    # highlight the code
    highlighted = highlight(code, lexer, formatter)

    # return rendered code block
    return (
        f'<pre class="code-block language-{lang}">'
        f"<code>{highlighted}</code></pre>"
    )

Metadata

Release files for pygments-ashen 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygments-ashen 0.1.3
File Size Uploaded Provenance Actions
pygments_ashen-0.1.3.tar.gz 5.8 kB Without provenance Details for pygments_ashen-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pygments-ashen 0.1.3
File Interpreter ABI Platform Actions
pygments_ashen-0.1.3-py3-none-any.whl Python 3 none any Details for pygments_ashen-0.1.3-py3-none-any.whl

Total release size: 10.1 kB

Release files / pygments_ashen-0.1.3.tar.gz

Download URL pygments_ashen-0.1.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2c69a931741f98fca531ef11d17bf690547f14a4382ec0fed7c7715a03aeaaf7
BLAKE2b-256 checksum
How to use checksums
0da4e2eeeeb8211b3425eeeeaa49a1d94a3c8bfd6046ce2723897fe778f03198
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.18

Release files / pygments_ashen-0.1.3-py3-none-any.whl

Download URL pygments_ashen-0.1.3-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5553a9302d581743d928b834cae8f3f62ee52a7fd8b72b73f04796a1c71cef3
BLAKE2b-256 checksum
How to use checksums
be2dd9b1b57c4cd394459d6b1456efc6cdaba8c9b8b1fa4d9023c69ad846c7cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.18

Security for pygments-ashen 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page