https://github.com/django-components/pygments-djc
Pygments Lexers for django-components
https://github.com/django-components/pygments-djc
Last synced: 3 months ago
JSON representation
Pygments Lexers for django-components
- Host: GitHub
- URL: https://github.com/django-components/pygments-djc
- Owner: django-components
- License: mit
- Created: 2025-02-11T19:56:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-11T07:51:28.000Z (10 months ago)
- Last Synced: 2025-08-30T01:44:55.687Z (9 months ago)
- Language: Python
- Size: 130 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# pygments-djc
[](https://pypi.org/project/pygments-djc/) [](https://pypi.org/project/pygments-djc/) [](https://github.com/django-components/pygments-djc/blob/main/LICENSE) [](https://pypistats.org/packages/pygments-djc) [](https://github.com/django-components/pygments-djc/actions/workflows/tests.yml)
_[Pygments](https://pygments.org/) Lexers for [django-components](https://pypi.org/project/django-components/)._
## Installation
1. Install the package:
```bash
pip install pygments-djc
```
2. Add the lexers to your Pygments configuration by simply importing `pygments_djc`
```python
import pygments_djc
```
## Lexers
### `DjangoComponentsPythonLexer`
Code blocks: `djc_py` / `djc_python`
This is the same as Python3 Lexer, but also highlights nested JS / CSS / HTML code blocks within `Component` classes:
```python
class MyComponent(Component):
template = """
Hello World
"""
```
The syntax highlight then looks like this:

## Release notes
Read the [Release Notes](https://github.com/django-components/pygments-djc/tree/main/CHANGELOG.md)
to see the latest features and fixes.
## Development
### Tests
To run tests, use:
```bash
pytest
```