Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/davidwinter/syntaxedit

A simple Python Qt syntax highlighting widget
https://github.com/davidwinter/syntaxedit

pygments pyqt pyside python qt qtpy syntax-highlighting

Last synced: about 2 months ago
JSON representation

A simple Python Qt syntax highlighting widget

Awesome Lists containing this project

README

        

# syntaxedit

[![test](https://github.com/davidwinter/syntaxedit/workflows/ci_cd/badge.svg)](https://github.com/davidwinter/syntaxedit/actions?query=workflow%3Aci_cd) [![PyPI](https://img.shields.io/pypi/v/syntaxedit)](https://pypi.org/project/syntaxedit/)

> A simple Python Qt syntax highlighting widget

![syntaxedit](https://raw.githubusercontent.com/davidwinter/syntaxedit/main/example.png)

## Features

- Extensive [syntax](https://pygments.org/languages/) and [theme](https://pygments.org/styles/) support - powered by [Pygments](https://pygments.org)
- Set font and font size
- Set indentation size

## Usage

1. Install package

```shell
pip install syntaxedit
```

Or

```shell
poetry add syntaxedit
```

2. In your app, include the package, and create a `SyntaxEdit` widget:

```python
from syntaxedit.core import SyntaxEdit

code = """# Todo list

- [ ] Go shopping
- [x] Walk the dog"""

widget = SyntaxEdit(code)
```

### Available options

- `content`: the initial content for the widget. **Default:** `""`
- `parent`: parent Qt widget for SyntaxEdit. **Default:** `None`
- `font`: the font family for the widget. **Default:** `"Courier New"`
- `font_size`: size to use for the font. **Default:** `13`
- `syntax`: the code [syntax](https://pygments.org/languages/) to use. **Default:** `"Markdown"`
- `theme`: the syntax [theme](https://pygments.org/styles/) to use. **Default:** `"solarized-light"`
- `indentation_size`: the size for indentation. **Default:** `4`
- `use_theme_background`: whether to use the background colour from the theme or to not set one. **Default:** `True`

## Authors

By [David Winter](https://github.com/davidwinter)

## License

MIT