GithubHelp home page GithubHelp logo

nhusung / pygments Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pygments/pygments

0.0 0.0 0.0 23.1 MB

Pygments is a generic syntax highlighter written in Python

Home Page: http://pygments.org/

License: BSD 2-Clause "Simplified" License

Shell 2.44% JavaScript 0.05% Ruby 1.72% C++ 1.61% Scheme 0.87% Python 79.67% Perl 0.90% C 2.04% ActionScript 0.11% PHP 0.34% Emacs Lisp 3.73% Erlang 0.11% Objective-C 0.06% Java 0.38% OCaml 0.80% Common Lisp 0.92% Lua 0.17% Haskell 0.94% Scala 0.21% Smalltalk 2.94%

pygments's Introduction

Welcome to Pygments

This is the source of Pygments. It is a generic syntax highlighter written in Python that supports over 500 languages and text formats, for use in code hosting, forums, wikis or other applications that need to prettify source code.

Installing

... works as usual, use pip install Pygments to get published versions, or python setup.py install to install from a checkout.

Documentation

... can be found online at https://pygments.org/ or created with Sphinx by :

make docs

By default, the documentation does not include the demo page, as it requires having Docker installed for building Pyodide. To build the documentation with the demo page, use :

WEBSITE_BUILD=1 make docs

The initial build might take some time, but subsequent ones should be instant because of Docker caching.

To view the generated documentation, serve it using Python's http.server module (this step is required for the demo to work) :

python3 -m http.server --directory doc/_build/html

Development

... takes place on GitHub, where the Git repository, tickets and pull requests can be viewed.

Continuous testing runs on GitHub workflows:

image

Contribution guidelines are found in Contributing.md.

Security considerations

Pygments provides no guarantees on execution time, which needs to be taken into consideration when using Pygments to process arbitrary user inputs. For example, if you have a web service which uses Pygments for highlighting, there may be inputs which will cause the Pygments process to run "forever" and/or use significant amounts of memory. This can subsequently be used to perform a remote denial-of-service attack on the server if the processes are not terminated quickly.

Unfortunately, it's practically impossible to harden Pygments itself against those issues: Some regular expressions can result in "catastrophic backtracking", but other bugs like incorrect matchers can also cause similar problems, and there is no way to find them in an automated fashion (short of solving the halting problem.) Pygments has extensive unit tests, automated randomized testing, and is also tested by OSS-Fuzz, but we will never be able to eliminate all bugs in this area.

Our recommendations are:

  • Ensure that the Pygments process is terminated after a reasonably short timeout. In general Pygments should take seconds at most for reasonably-sized input.
  • Limit the number of concurrent Pygments processes to avoid oversubscription of resources.

The Pygments authors will treat any bug resulting in long processing times with high priority -- it's one of those things that will be fixed in a patch release. When reporting a bug where you suspect super-linear execution times, please make sure to attach an input to reproduce it.

The authors

Pygments is maintained by Georg Brandl, e-mail address [email protected], Matthäus Chajdas and Jean Abou-Samra.

Many lexers and fixes have been contributed by Armin Ronacher, the rest of the Pocoo team and Tim Hatch.

The code is distributed under the BSD 2-clause license. Contributors making pull requests must agree that they are able and willing to put their contributions under that license.

pygments's People

Contributors

birkenfeld avatar thatch avatar anteru avatar hoelzro avatar jaingaurav avatar roskakori avatar jrnold avatar blu-base avatar ericfromcanada avatar jeanas avatar colinkennedy avatar andyli avatar hhsprings avatar nwhetsell avatar dvarrazzo avatar cmclaughlin avatar not-my-profile avatar dscorbett avatar jambonrose avatar robsimmons avatar camilstaps avatar miikkas avatar dietmarw avatar kurtmckee avatar jjatria avatar mitsuhiko avatar tinnet avatar kristianlyng avatar oldes avatar rrthomas 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.