All Projects → bfontaine → Clygments

bfontaine / Clygments

Licence: epl-1.0
🎨 Code highlighting using Pygments in Clojure

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to Clygments

Brackeys Ide
👨‍💻 Brackeys IDE is a fast and free multi-language code editor for Android.
Stars: ✭ 154 (+600%)
Mutual labels:  library, syntax-highlighting
Xtoolkit.whitelabel
Modular MVVM framework for fast creating powerful cross-platform applications with Xamarin.
Stars: ✭ 22 (+0%)
Mutual labels:  library
Matter
Material Design Components in Pure CSS. Materializing HTML at just one class per component 🍰
Stars: ✭ 888 (+3936.36%)
Mutual labels:  library
Styledecorator
Easy string decoration with styles
Stars: ✭ 17 (-22.73%)
Mutual labels:  library
Shpref Library
💾 Android Kotlin library. Shared preferences wrapper. (2020)
Stars: ✭ 16 (-27.27%)
Mutual labels:  library
Coord Rs
[deprecated] A simple, ergonomic vector mathematics crate for Rust
Stars: ✭ 18 (-18.18%)
Mutual labels:  library
Realm Core
Core database component for the Realm Mobile Database SDKs
Stars: ✭ 836 (+3700%)
Mutual labels:  library
New Moon
🌙 ‎ The optimized dark theme for web development.
Stars: ✭ 918 (+4072.73%)
Mutual labels:  syntax-highlighting
Mondocks
An alternative way to interact with MongoDB databases from F# that allows you to use mongo-idiomatic constructs
Stars: ✭ 20 (-9.09%)
Mutual labels:  library
Multicolortextview
Stars: ✭ 17 (-22.73%)
Mutual labels:  library
6502 Npp Syntax
Notepad++ Syntax Highlighting for 6502 Assembly (and NESASM)
Stars: ✭ 17 (-22.73%)
Mutual labels:  syntax-highlighting
Galgo Ios
When you want your logs to be displayed on screen
Stars: ✭ 16 (-27.27%)
Mutual labels:  library
B24
Bitrix24 Client Library
Stars: ✭ 18 (-18.18%)
Mutual labels:  library
Elongation Preview
ElongationPreview is an elegant UI push-pop style view controller. iOS library made by @Ramotion
Stars: ✭ 888 (+3936.36%)
Mutual labels:  library
Functions.js
📦 A hub of numerous functions with various functionalities
Stars: ✭ 22 (+0%)
Mutual labels:  library
Storagedb
MongoDB-like API for HTML5 Storage (localStorage and sessionStorage)
Stars: ✭ 16 (-27.27%)
Mutual labels:  library
Scalable Image Matching
This is a image matching system for scalable and efficient matching of images from a large database. The basic idea is to compute perceptural hash value for each image and compare the similarity based on the pHash computed. Searching are scalable with the elasticsearch as the backend database.
Stars: ✭ 17 (-22.73%)
Mutual labels:  library
Sublimetext
Caddyfile syntax highlighting for Sublime Text 3
Stars: ✭ 17 (-22.73%)
Mutual labels:  syntax-highlighting
Crab
JavaScript library for building user interfaces with Custom Elements, Shadow DOM and React like API
Stars: ✭ 22 (+0%)
Mutual labels:  library
Itext7
iText 7 for Java represents the next level of SDKs for developers that want to take advantage of the benefits PDF can bring. Equipped with a better document engine, high and low-level programming capabilities and the ability to create, edit and enhance PDF documents, iText 7 can be a boon to nearly every workflow.
Stars: ✭ 913 (+4050%)
Mutual labels:  library

clygments

Build Status Coverage Status Clojars Project

clygments is a Clojure wrapper for Pygments.

Usage

Add the dependency in your project.clj:

[clygments "2.0.2"]

Then:

(ns your-project.core
  (:require [clygments.core :as clygments]))

It exposes only one function, highlight. Give it your code as a string, its language and the desired output and it’ll do that for you :)

It’ll return a string or nil if there was an error, like an unsupported language or output.

Example

(clygments/highlight "(def x (+ 20 22))" :clojure :html)
;; => <div class=\"highlight\"><pre><span class=\"p\">(</span><span class=\"k\">def </span><span class=\"nv\">x</span> <span class=\"mi\">42</span><span class=\"p\">)</span>\n</pre></div>

Support

Clygments 1.0.0+ only supports Java 7+.

Langages

See Pygments’ list for a list of available languages.

If nil is passed as a language we use Pygments’ guess_lexer. Note it takes more time and might not be accurate on small code snippets.

Output

  • :bbcode
  • :html
  • :latex
  • :null (no formatting, this leaves the code unchanged)
  • :raw
  • :rtf
  • :svg
  • :terminal256
  • :terminal

Images outputs are not supported. See also Pygments docs for the full list.

Options

All lexers’ and formatters’ options are supported since version 0.1.1. They are given as a map to highlight and support hyphens for a better readability. See Pygments’ docs for more info.

Example

;; expand tabs to 4 spaces
(cligments/highlight "def foo():\n\tpass" :python :html {:tab-size 4})

;; generate a full standalone HTML document with a custom title
(cligments/highlight "int i = 2+2;" :C :html {:full true, :title "This is my code"})

License

Copyright © 2014-2020 Baptiste Fontaine

Distributed under the Eclipse Public License either version 1.0 or any later version.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].