pygments / pygments/pygments

Support `pygmentize -S STYLE -f your_formatter.py -x`

Open
#1,769 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-api
Dominant language
Python
Stars
2.2k
Forks
885
PR merge metrics
No merged PRs in 30d

Description

Once I patched LaTeX package minted to support custom formatters, see https://github.com/gpoore/minted/issues/176#issuecomment-695344998. Today when I tried providing a workaround for https://github.com/gpoore/minted/issues/299 by loading a custom formatter relative to current directory, I realized then the patched minted will call pygmentize -S STYLE -f your_formatter.py -x, which is not yet supported.

Source lines handling -S STYLE,
https://github.com/pygments/pygments/blob/cfaa45dcc4103da8cf1700fd0d3e5708d894337b/pygments/cmdline.py#L216-L236

and the logic handling -f formater
https://github.com/pygments/pygments/blob/cfaa45dcc4103da8cf1700fd0d3e5708d894337b/pygments/cmdline.py#L346-L375

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pygments/cmdline.py, at the source-line handling for -S STYLE and the formatter logic linked in the issue. Trace how each option is parsed and combined, then verify that pygmentize -S STYLE -f your_formatter.py -x supports a formatter loaded relative to the current directory. Done means the command works for the custom formatter use case described.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.