Advanced syntax highlighter with built-in compiler
Project description
Highlighter
Advanced syntax highlighting library with built-in compiler (dockr) for multiple languages.
Features
- Syntax highlighting for 15+ languages
- Integrated compiler/runner (dockr)
- Customizable color schemes
- HTML and terminal output formats
- Easy to extend with new languages
Installation
pip install highlighter
Usage
Syntax Highlighting
from highlighter import Highlighter
hl = Highlighter()
code = """
def hello(name):
print(f"Hello, {name}!")
"""
# Get HTML output
html_output = hl.highlight(code, "python")
print(html_output)
# Get terminal output
term_output = hl.highlight(code, "python", output_format="terminal")
print(term_output)
# Get CSS for the highlighting
print(hl.get_css())
Dockr Compiler
from highlighter import DockrCompiler
compiler = DockrCompiler()
code = """
#include <stdio.h>
int main() {
printf("Hello from C!\\n");
return 0;
}
"""
output, error, return_code = compiler.compile_and_run(code, "c")
print(f"Output: {output}")
print(f"Error: {error}")
print(f"Return code: {return_code}")
Command Line Usage
# Run a Python file
dockr script.py
# Run a C file with input
dockr program.c -i input.txt
Supported Languages
- Python, JavaScript, Ruby, PHP, Lua
- C, C++, Java, Rust, Zig
- HTML, CSS, SCSS
- And more!
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyhighlighter_c-1.0.0.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyhighlighter_c-1.0.0.tar.gz.
File metadata
- Download URL: pyhighlighter_c-1.0.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f39148c1b88c2cdd4a0153f821973424513ffff6701b1429d5e97db299667738
|
|
| MD5 |
675d18cf2aa7d31a5707dc29110e2e45
|
|
| BLAKE2b-256 |
7a6d1cc7b9c51ebbf9c429847f2178aa03e0524ae0e54f654789b3c2369c96e3
|
File details
Details for the file pyhighlighter_c-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyhighlighter_c-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7c7bbf67c10b81003b51faf1e2169dc864d37fa2c1511b1721762732cbaebe9
|
|
| MD5 |
fb7c2005afaf7d0021f0f7c65efd7a17
|
|
| BLAKE2b-256 |
093dc8a814c1b903d218b53b2d6f19912239ca9dce169ccabc9da2814b90376f
|