• This repository has been archived on 31/Jul/2020
  • Stars
    star
    109
  • Rank 308,283 (Top 7 %)
  • Language
    HTML
  • License
    GNU General Publi...
  • Created over 13 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A syntax highlighting library in Haskell, based on Kate syntax definitions

highlighting-kate

This library has been deprecated. Please use skylighting instead (Hackage | GitHub).

A Haskell source code highlighting library, based on Kate's syntax description files (http://kate-editor.org/), now part of the KDE Framework's "KTextEditor" component. It can produce both HTML and LaTeX output.

Building

To install, use the stack tool:

stack install

Note: If you have checked out the source from the git repository, you will first need to do:

make prep

which generates some of the needed source files from xml syntax definitions.

To generate the documentation:

stack haddock

To run the test suite:

stack test

For an example of the use of the library, see highlighting-kate.hs.

By default, this installation method will install an executable, highlighting-kate, along with the library. Normally this is put into $HOME/.local/bin. To avoid creation of the executable, use --flag highlighting-kate:-executable with the stack commands above.

Using

If you want to use highlighting-kate as a library in a Haskell program, see the API documentation at https://hackage.haskell.org/package/highlighting-kate.

To run the highlighting-kate program, specify the language name using -s:

highlighting-kate -s haskell highlighting-kate.hs > example.html

If you don't specify a language name, highlighting-kate will try to guess it from the file extension.highlighting-kate can also be used as a pipe, reading input from STDIN. For other options,

highlighting-kate --help

Styling is done using span tags. The Highlight program will include default styles in the generated HTML, unless a link to a CSS file is provided using the '--css' option. Some sample CSS files can be found in the css directory. These use generic class names (Normal, Keyword, DataType, DecVal, BaseN, Float, Char, String, Comment, Function, Others, Alert, Error). For more fine-grained highlighting, users may wish to create their own CSS files that use language-specific classes.

Adding syntax definitions

The parsers in Text/Highlighting/Kate/Syntax were automatically generated from the Kate syntax definitions in the xml directory. You may modify the xml files in this directory, or add new ones, and then regenerate the parsers by doing:

make prep

Note that ParseSyntaxFiles.hs requires the HXT package (>= 9.0.0). make prep should install this automatically.

To get the current Kate syntax highlighting files, clone the ktexteditor repository:

git clone git://anongit.kde.org/ktexteditor

The syntax definitions can then be found in

src/syntax/data

There is information on the syntax highlighting definitions at https://docs.kde.org/stable5/en/applications/katepart/highlight.html. See also http://kate-editor.org/2005/03/24/writing-a-syntax-highlighting-file/.

Thanks are due to all the authors of these syntax definitions.

Changes have been made to the following xml files (diffs have been left in the directory, with .patch extensions):

  • haskell.xml: Small changes to mapping of styles to token types.
  • lua.xml: Variables and constants highlighted as "normal", not keywords.
  • perl.xml: Small regex change due to differences in regex engines.
  • php.xml: Added fallthrough so <?php prefix not needed.
  • tcsh.xml: Replace invalid character assignment(?) of regex '\s' with ' '.

More Repositories

1

pandoc

Universal markup converter
Haskell
32,409
star
2

gitit

A wiki using HAppS, pandoc, and git
Haskell
2,126
star
3

djot

A light markup language
HTML
1,557
star
4

peg-markdown

An implementation of markdown in C, using a PEG grammar
C
686
star
5

pandocfilters

A python module for writing pandoc filters, with a collection of examples
Python
494
star
6

pandoc-templates

Templates for pandoc, tagged to release
HTML
418
star
7

yst

create static websites from YAML data and string templates
Haskell
373
star
8

texmath

A Haskell library for converting LaTeX math to MathML.
Haskell
291
star
9

pandoc-citeproc

Library and executable for using citeproc with pandoc
Haskell
288
star
10

lunamark

Lua library for conversion between markup formats
C
186
star
11

skylighting

A Haskell syntax highlighting library with tokenizers derived from KDE syntax highlighting descriptions
Haskell
185
star
12

citeproc

CSL citation processing library in Haskell
Haskell
138
star
13

commonmark-hs

Pure Haskell commonmark parsing library, designed to be flexible and extensible
Haskell
130
star
14

djot.js

JavaScript implementation of djot
TypeScript
120
star
15

cheapskate

Experimental markdown processor in Haskell
HTML
105
star
16

pandoc-types

types for representing structured documents
Haskell
105
star
17

gitit2

A reimplementation of gitit in Yesod
Haskell
94
star
18

lcmark

Flexible CommonMark converter
Lua
54
star
19

doctemplates

Pandoc-compatible templating system
Haskell
49
star
20

zip-archive

Native Haskell library for working with zip archives
Haskell
44
star
21

cmark-hs

Haskell bindings to libcmark commonmark parser
C
43
star
22

djot.lua

Lua parser for the djot light markup language
Lua
39
star
23

typst-hs

Haskell library for parsing and evaluating typst
Haskell
32
star
24

dotvim

My vim configuration
Vim Script
30
star
25

scripts

A collection of small scripts to do various things
Shell
28
star
26

filestore

A versioning file store backed by git, darcs, or mercurial
Haskell
28
star
27

pandoc-website

Source files for pandoc's website
Lua
28
star
28

illuminate

An efficient syntax highlighting library in Haskell, using alex-generated lexers
Haskell
26
star
29

emojis

Haskell library for emojis
Haskell
25
star
30

markdown-peg

A Haskell implementation of markdown using a PEG grammar
Haskell
24
star
31

pandoc-server

Simple server app for pandoc conversions.
Haskell
20
star
32

doclayout

A prettyprinting library designed for laying out plain text documents
Haskell
20
star
33

standalone-html

Incorporates external dependencies into HTML file using data: URI scheme
Haskell
19
star
34

pandoc-tex2svg

Pandoc filter to convert math to SVG using MathJax-node's tex2svg
HTML
19
star
35

cloudlib

tools for keeping a library of books and articles on Amazon's S3 and SimpleDB
Ruby
19
star
36

cmark-lua

Lua bindings to libcmark CommonMark parser
C
17
star
37

HeX

a flexible text macro system
Haskell
17
star
38

djoths

Haskell parser for the djot light markup language
Haskell
17
star
39

unicode-collation

Haskell implementation of the Unicode Collation Algorithm
Haskell
16
star
40

sep-offprint

Creates formatted "offprints" of Stanford Encyclopedia of Philosophy entries.
15
star
41

BayHac2014

Slides for my presentation on pandoc at BayHac2014
TeX
14
star
42

cmarkpdf

Steps towards a PDF renderer for cmark using libharu
C
14
star
43

lunamark-standalone

Standalone version of lunamark (compiled with no library dependencies)
C
12
star
44

commonmarker

Ruby wrapper for libcmark (CommonMark parser)
Ruby
12
star
45

hsb2hs

Preprocessor for inserting literals with binary blobs into Haskell programs.
Haskell
11
star
46

ipynb

Data structures and JSON serializer/deserializer for Jupyter notebooks (.ipynb) format.
Jupyter Notebook
10
star
47

gogar

Computer implementation of Robert Brandom's "game of giving and asking for reasons," from Making It Explicit, chapter 3.
Ruby
10
star
48

emacsd

emacs configuration
Emacs Lisp
9
star
49

hscommonmark

pure Haskell CommonMark parser
Haskell
9
star
50

recaptcha

Haskell library for using the reCAPTCHA service
Haskell
8
star
51

select-meta

Pandoc lua filter for constructing metadata from YAML data sources using queries
Lua
8
star
52

html2cmark

Lua library to convert HTML5 to commonmark
Lua
8
star
53

citeproc-hs-bin

Command-line interface to the citeproc-hs CSL citation processing library
Haskell
8
star
54

grammata

Well-typed system for generating documents in multiple formats
Haskell
7
star
55

ecstatic

Static website management using tenjin templates and YAML data files
Ruby
7
star
56

hw2gitit

Script to convert haskellwiki pages to a gitit wiki
Haskell
7
star
57

hsgit

A higher-level interface to libgit2 functions than hlibgit2
Haskell
6
star
58

pandoc-highlight

Filter and library for using pandoc with highlighting-kate
Haskell
6
star
59

trypandoc

Live demo of pandoc
JavaScript
6
star
60

commonmark-lua

Lua binding to libcmark commonmark parser
Lua
5
star
61

rfc5051

Haskell implementation of RFC5051, simple unicode collation.
Haskell
5
star
62

jgm.github.com

jgm's web pages on github
4
star
63

rocks

luarocks repository
4
star
64

GHCUnicodeAlt

Improved version of GHC.Unicode, with benchmarks
Haskell
3
star
65

cmark-fuzz-data

A minimal fuzz test suite for cmark created by american fuzzy lop and afl-cmin
3
star
66

luacmark

Lua binding to CommonMark
C
2
star
67

typst-symbols

Defines symbols and emoji used in typst
Haskell
2
star