Coder Social home page Coder Social logo

jgm / highlighting-kate Goto Github PK

View Code? Open in Web Editor NEW
109.0 10.0 58.0 2.05 MB

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

License: GNU General Public License v2.0

Makefile 0.22% Haskell 24.96% CSS 1.30% Ada 0.66% HTML 67.72% C 0.29% C++ 0.36% C# 0.68% D 0.35% Go 0.29% Java 0.54% Common Lisp 0.14% MATLAB 0.23% Perl 0.14% PHP 0.21% Prolog 0.19% R 0.21% Scala 0.55% Tcl 0.19% Lua 0.76%

highlighting-kate's Introduction

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 ' '.

highlighting-kate's People

Contributors

adrientetar avatar agraef avatar alpmestan avatar basbossink avatar bergmark avatar bjornbm avatar bjpe avatar briancappello avatar casphas avatar clinty avatar dcjones avatar fryguybob avatar geoff-nixon avatar hadley avatar igstan avatar jgm avatar jtanguy avatar master-q avatar mcmtroffaes avatar ondras avatar pbrisbin avatar projedi avatar sapek avatar shabbyx avatar sjakobi avatar stanlyshauro avatar supernullset avatar tianyicui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.