pygments / pygments/pygments

Extend Dockerfile Lexer to Recognize Alternative Naming Conventions and Support Valid MIME Type

Open
#2,870 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently, Pygments supports syntax highlighting for Dockerfile and files matching *.docker, but it does not detect several commonly used alternative naming conventions, such as:

  • Dockerfile.backend
  • Dockerfile.frontend
  • Dockerfile.streamlit
  • Dockerfile.dev
  • Dockerfile.prod
  • backend.dockerfile
  • frontend.dockerfile
  • dev.dockerfile
  • prod.dockerfile

These naming variations are widely used in projects that maintain multiple Dockerfiles for different environments or services.

In addition, it would be beneficial if the Dockerfile lexer also supported the valid MIME type text/x-dockerfile.

Could the lexer be extended to:
Recognize the alternative naming conventions listed above.
Support the MIME type text/x-dockerfile for better interoperability?

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 by locating the Dockerfile lexer and its existing filename and MIME-type detection rules. Check the lexer tests, if present, for current Dockerfile and *.docker coverage. Done means the listed naming conventions and text/x-dockerfile are recognized without breaking existing detection.

Written by the indexing model from the issue text.

Assessment

Tech stack
dockerfile, python
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.