Skip to main content

##Introduce pyhilite is Python3 binding of GNU Source Highlight.

given a source file, produces a document with syntax highlighting

For more details, please refer to [src-highlite](https://www.gnu.org/software/src-highlite/)

##Dependency pyhilite depends on the GNU Source Highlight C++ highlight library.

for Fedora22

# dnf install source-highlight-devel

for Ubuntu15.04

# apt-get install libsource-highlight-dev

the package name for other linux distributions should be similar.

##Installation

pip3 install pyhilite

##Sample

>>> import pyhilite
>>> h = pyhilite.SourceHighlight(outlang="html")
>>> h.highlight(input='hello.c')
'<!-- Generator: GNU source-highlight 3.1.7\nby Lorenzo Bettini\nhttp://www.lorenzobettini.it\nhttp://www.gnu.org/software/src-highlite -->\n<pre><tt><b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;stdio.h&gt;</font>\n\n\n<font color="#009900">int</font> <b><font color="#000000">main</font></b><font color="#990000">(</font><font color="#009900">int</font> argc<font color="#990000">,</font> <b><font color="#0000FF">const</font></b> <font color="#009900">char</font> <font color="#990000">*</font>argv<font color="#990000">[])</font>\n<font color="#FF0000">{</font>\n    <b><font color="#000000">printf</font></b><font color="#990000">(</font><font color="#FF0000">"hello world!</font><font color="#CC33CC">\\n</font><font color="#FF0000">"</font><font color="#990000">);</font>\n    <b><font color="#0000FF">return</font></b> <font color="#993399">0</font><font color="#990000">;</font>\n<font color="#FF0000">}</font>\n</tt></pre>\n'
>>> h.highlight(input='hello.c', output='output.html')

##Screenshot ![hicat.py](https://github.com/wiiiky/pyhilite/blob/master/screenshot.png)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyhilite-0.2.0.tar.gz (58.5 kB view details)

Uploaded Source

File details

Details for the file pyhilite-0.2.0.tar.gz.

File metadata

  • Download URL: pyhilite-0.2.0.tar.gz
  • Upload date:
  • Size: 58.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyhilite-0.2.0.tar.gz
Algorithm Hash digest
SHA256 90206f78407acfb2f7be84114389df2b38ffdd52ec6dcc64f86768937a12efb0
MD5 e97d92ba007a576f7743430edd93802b
BLAKE2b-256 1adc76da79708d2839cdf2bef57c6f95442cc390eaadd28a2bf40a0e514fb5c2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page