ghc-syntax-highlighter alternatives and similar packages
Based on the "Text" category.
Alternatively, view ghc-syntax-highlighter alternatives based on common mentions on social networks and blogs.
-
pandoc-citeproc
Supports using pandoc with citeproc -
pandoc-crossref
Pandoc filter for cross-references -
scholdoc
Converts ScholarlyMarkdown documents to HTML5/LaTeX/Docx format -
prettyprinter
A modern, extensible and well-documented prettyprinter. -
blaze-from-html
Tool to convert HTML to BlazeHtml code. -
texmath
Conversion between formats used to represent mathematics. -
hxt-charproperties
Character properties and classes for XML and Unicode -
formatting
Combinator-based type-safe formatting (like printf() or FORMAT) -
pandoc-types
Types for representing a structured document -
regex-genex
From a regex, generate all possible strings it can match -
text-offset
Library for converting between line/column and byte offset. -
regex-applicative
Regex-based parsing with applicative interface -
servant-checked-exceptions
Checked exceptions for Servant APIs. -
pandoc-csv2table
Convert CSV to Pandoc Table Markdown -
pretty-show
Tools for working with derived `Show` instances and generic inspection of values. -
diagrams-pandoc
A Pandoc filter to express diagrams inline using the Haskell EDSL _Diagrams_ -
email-validate
Validating an email address string against RFC 5322 -
marked-pretty
Pretty-printing library, with scoping, based on pretty.
Get performance insights in less than 4 minutes.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of ghc-syntax-highlighter or a related project?
README
GHC syntax highligher
This is a syntax highlighter library for Haskell using lexer of GHC itself.
Here is a blog post announcing the package, the readme is mostly derived from it:
Motivation
Parsing Haskell is hard, because Haskell is a complex language with
countless features. The only way to get it right 100% is to use parser of
GHC itself. Fortunately, now there is the ghc
package, which as of
version 8.4.1 exports enough of GHC's source code to allow us use its lexer.
Alternative approaches, even decent ones like highlight.js
either
don't support cutting-edge features or do their work without sufficient
precision so that many tokens end up combined and the end result is
typically still hard to read.
How to use it in your blog
Depends on your markdown processor. If you're an mmark
user, good
news, since version 0.2.1.0 of mmark-ext
it includes the
ghcSyntaxHighlighter
extension. Due to flexibility of MMark, it's possible
to use this highlighter for Haskell and skylighting
as a
fall-back for everything else. Consult the docs for more
information.
skylighting is what Pandoc uses. And from what I can tell it's hardcoded to use only that library for highlighting, so some creativity may be necessary to get it work.
Limitations
CPP directives are not lexed correctly, because the GHC parser is not designed to parse them.
Contribution
Issues, bugs, and questions may be reported in the GitHub issue tracker for this project.
Pull requests are also welcome.
License
Copyright © 2018–present Mark Karpov
Distributed under BSD 3 clause license.
*Note that all licence references and agreements mentioned in the ghc-syntax-highlighter README section above
are relevant to that project's source code only.