adamchainz / adamchainz/pygments-git

git-config lexer

Open
#125 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8
Forks
0
Avg merge
1d 3h
Merged PRs (30d)
1

Description

Description

Pygments ini lexer doesn't support backslash escapes inside quoted values:

[alias]
    u = "!f() { git add --update \"$1\" && git status; }; f"

It also warns when there's a multiline string:

[alias]
    <name> = "!f() { \
        <commands>; \
    }; f"

warning:

example.rst:1: WARNING: Lexing literal_block '[alias]\n    <name> = "!f() { \\\n        <commands>; \\\n    }; f"' as "ini" resulted in an error at token: '!'. Retrying in relaxed mode. [misc.highlighting_failure]

“Relaxed mode” leaves an error highlight on the first line of the value.

Given that the second issue here, at least, is Git-specific, it seems warranted to make a Git-config-specific lexer.

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 with the Pygments ini lexer and the two Git-config snippets in this issue. Reproduce the escaped quoted value and multiline value cases, then verify that a Git-config-specific lexer handles both without warnings or error highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.