diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000000..a6c6adb30c
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,3 @@
+[run]
+include =
+ pygments/*
diff --git a/.github/actions/pyodide-package/action.yml b/.github/actions/pyodide-package/action.yml
new file mode 100644
index 0000000000..2187cd9fc1
--- /dev/null
+++ b/.github/actions/pyodide-package/action.yml
@@ -0,0 +1,5 @@
+name: 'Update Pyodide package'
+description: 'Update the WASM compiled Pygments with Pyodide'
+runs:
+ using: 'docker'
+ image: 'birkenfeld/pyodide-pygments-builder'
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 0000000000..22134e980a
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,42 @@
+name: Pygments
+
+on: [push, pull_request]
+
+jobs:
+ build:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest]
+ python-version: [3.5, 3.6, 3.7, 3.8, 3.9, pypy3]
+ max-parallel: 4
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install package
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r requirements.txt
+ pip install .
+ - name: Test package
+ run: make test TEST=-v
+ if: runner.os == 'Linux'
+ - name: Test package
+ run: py.test
+ if: runner.os == 'Windows' && ! contains(matrix['python-version'], 'pypy')
+
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+ - name: Check out regexlint
+ run: git clone https://github.com/pygments/regexlint
+ - name: Run regexlint
+ run: make regexlint REGEXLINT=`pwd`/regexlint
diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml
new file mode 100644
index 0000000000..6a4bb730c5
--- /dev/null
+++ b/.github/workflows/docs.yaml
@@ -0,0 +1,36 @@
+name: Docs
+
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup Python
+ uses: actions/setup-python@v1
+ with:
+ python-version: 3.7
+ - name: Checkout Pygments
+ uses: actions/checkout@v1
+ - name: Install Sphinx
+ run: pip install Sphinx
+ - name: Create Pyodide WASM package
+ uses: ./.github/actions/pyodide-package
+ - name: Sphinx build
+ run: |
+ cd doc
+ WEBSITE_BUILD=1 make dirhtml
+ cp -a ../pyodide _build/dirhtml/_static
+ touch _build/dirhtml/.nojekyll
+ echo -e 'pygments.org\nwww.pygments.org' > _build/dirhtml/CNAME
+ echo 'Automated deployment of docs for GitHub pages.' > _build/dirhtml/README
+ - name: Deploy to repo
+ uses: peaceiris/actions-gh-pages@v2.5.0
+ env:
+ ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
+ EXTERNAL_REPOSITORY: pygments/pygments.github.io
+ PUBLISH_BRANCH: master
+ PUBLISH_DIR: ./doc/_build/dirhtml
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..502a19ad14
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+*.egg
+*.pyc
+*.pyo
+.*.sw[op]
+/.pytest_cache/
+/.idea/
+/.project
+/.tags
+/.tox/
+/.cache/
+/Pygments.egg-info/*
+/TAGS
+/build/*
+/dist/*
+/doc/_build
+/.coverage
+/htmlcov
+/tests/examplefiles/output
+/.vscode
\ No newline at end of file
diff --git a/.hgignore b/.hgignore
deleted file mode 100644
index b564df833f..0000000000
--- a/.hgignore
+++ /dev/null
@@ -1,20 +0,0 @@
-syntax: glob
-*.egg
-*.pyc
-*.pyo
-.*.sw[op]
-.idea/
-.ropeproject
-.project
-.tags
-.tox
-.cache/
-Pygments.egg-info/*
-TAGS
-build/*
-dist/*
-doc/_build
-TAGS
-tests/.coverage
-tests/cover
-tests/examplefiles/output
diff --git a/AUTHORS b/AUTHORS
index 18e642f186..a5c9fb5030 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -7,7 +7,8 @@ Other contributors, listed alphabetically, are:
* Sam Aaron -- Ioke lexer
* Ali Afshar -- image formatter
-* Thomas Aglassinger -- Easytrieve, JCL, Rexx and Transact-SQL lexers
+* Thomas Aglassinger -- Easytrieve, JCL, Rexx, Transact-SQL and VBScript
+ lexers
* Muthiah Annamalai -- Ezhil lexer
* Kumar Appaiah -- Debian control lexer
* Andreas Amann -- AppleScript lexer
@@ -31,8 +32,10 @@ Other contributors, listed alphabetically, are:
* Sébastien Bigaret -- QVT Operational lexer
* Jarrett Billingsley -- MiniD lexer
* Adam Blinkinsop -- Haskell, Redcode lexers
+* Stéphane Blondon -- SGF and Sieve lexers
* Frits van Bommel -- assembler lexers
* Pierre Bourdon -- bugfixes
+* Martijn Braam -- Kernel log lexer, BARE lexer
* Matthias Bussonnier -- ANSI style handling for terminal-256 formatter
* chebee7i -- Python traceback lexer improvements
* Hiram Chirino -- Scaml and Jade lexers
@@ -53,24 +56,29 @@ Other contributors, listed alphabetically, are:
* Sven Efftinge -- Xtend lexer
* Artem Egorkine -- terminal256 formatter
* Matthew Fernandez -- CAmkES lexer
+* Paweł Fertyk -- GDScript lexer, HTML formatter improvements
* Michael Ficarra -- CPSA lexer
* James H. Fisher -- PostScript lexer
* William S. Fulton -- SWIG lexer
* Carlos Galdino -- Elixir and Elixir Console lexers
* Michael Galloy -- IDL lexer
* Naveen Garg -- Autohotkey lexer
+* Simon Garnotel -- FreeFem++ lexer
* Laurent Gautier -- R/S lexer
* Alex Gaynor -- PyPy log lexer
* Richard Gerkin -- Igor Pro lexer
* Alain Gilbert -- TypeScript lexer
* Alex Gilding -- BlitzBasic lexer
+* GitHub, Inc -- DASM16, Augeas, TOML, and Slash lexers
* Bertrand Goetzmann -- Groovy lexer
* Krzysiek Goj -- Scala lexer
+* Rostyslav Golda -- FloScript lexer
* Andrey Golovizin -- BibTeX lexers
* Matt Good -- Genshi, Cheetah lexers
* Michał Górny -- vim modeline support
* Alex Gosse -- TrafficScript lexer
* Patrick Gotthardt -- PHP namespaces support
+* Hubert Gruniaux -- C and C++ lexer improvements
* Olivier Guibe -- Asymptote lexer
* Phil Hagelberg -- Fennel lexer
* Florian Hahn -- Boogie lexer
@@ -83,6 +91,7 @@ Other contributors, listed alphabetically, are:
* Justin Hendrick -- ParaSail lexer
* Jordi Gutiérrez Hermoso -- Octave lexer
* David Hess, Fish Software, Inc. -- Objective-J lexer
+* Ken Hilton -- Typographic Number Theory and Arrow lexers
* Varun Hiremath -- Debian control lexer
* Rob Hoelz -- Perl 6 lexer
* Doug Hogan -- Mscgen lexer
@@ -99,6 +108,7 @@ Other contributors, listed alphabetically, are:
* Dennis Kaarsemaker -- sources.list lexer
* Dmitri Kabak -- Inferno Limbo lexer
* Igor Kalnitsky -- vhdl lexer
+* Colin Kennedy - USD lexer
* Alexander Kit -- MaskJS lexer
* Pekka Klärck -- Robot Framework lexer
* Gerwin Klein -- Isabelle lexer
@@ -130,6 +140,7 @@ Other contributors, listed alphabetically, are:
* Stephen McKamey -- Duel/JBST lexer
* Brian McKenna -- F# lexer
* Charles McLaughlin -- Puppet lexer
+* Kurt McKee -- Tera Term macro lexer, PostgreSQL updates, MySQL overhaul
* Lukas Meuser -- BBCode formatter, Lua lexer
* Cat Miller -- Pig lexer
* Paul Miller -- LiveScript lexer
@@ -146,6 +157,7 @@ Other contributors, listed alphabetically, are:
* Nam T. Nguyen -- Monokai style
* Jesper Noehr -- HTML formatter "anchorlinenos"
* Mike Nolta -- Julia lexer
+* Avery Nortonsmith -- Pointless lexer
* Jonas Obrist -- BBCode lexer
* Edward O'Callaghan -- Cryptol lexer
* David Oliva -- Rebol lexer
@@ -158,8 +170,10 @@ Other contributors, listed alphabetically, are:
* Clément Prévost -- UrbiScript lexer
* Tanner Prynn -- cmdline -x option and loading lexers from files
* Oleh Prypin -- Crystal lexer (based on Ruby lexer)
+* Xidorn Quan -- Web IDL lexer
* Elias Rabel -- Fortran fixed form lexer
* raichoo -- Idris lexer
+* Daniel Ramirez -- GDScript lexer
* Kashif Rasul -- CUDA lexer
* Nathan Reed -- HLSL lexer
* Justin Reidy -- MXML lexer
@@ -175,10 +189,12 @@ Other contributors, listed alphabetically, are:
* Stou Sandalski -- NumPy, FORTRAN, tcsh and XSLT lexers
* Matteo Sasso -- Common Lisp lexer
* Joe Schafer -- Ada lexer
+* Max Schillinger -- TiddlyWiki5 lexer
* Ken Schutte -- Matlab lexers
* René Schwaiger -- Rainbow Dash style
* Sebastian Schweizer -- Whiley lexer
* Tassilo Schweyer -- Io, MOOCode lexers
+* Pablo Seminario -- PromQL lexer
* Ted Shaw -- AutoIt lexer
* Joerg Sieker -- ABAP lexer
* Robert Simmons -- Standard ML lexer
@@ -187,7 +203,7 @@ Other contributors, listed alphabetically, are:
* Alexander Smishlajev -- Visual FoxPro lexer
* Steve Spigarelli -- XQuery lexer
* Jerome St-Louis -- eC lexer
-* Camil Staps -- Clean and NuSMV lexers
+* Camil Staps -- Clean and NuSMV lexers; Solarized style
* James Strachan -- Kotlin lexer
* Tom Stuart -- Treetop lexer
* Colin Sullivan -- SuperCollider lexer
@@ -218,5 +234,6 @@ Other contributors, listed alphabetically, are:
* Alex Zimin -- Nemerle lexer
* Rob Zimmerman -- Kal lexer
* Vincent Zurczak -- Roboconf lexer
+* 15b3 -- Image Formatter improvements
Many thanks for all contributions!
diff --git a/CHANGES b/CHANGES
index b63627852f..481ead5edd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,10 +1,394 @@
Pygments changelog
==================
-Issue numbers refer to the tracker at
-,
+Since 2.5.0, issue numbers refer to the tracker at
+,
pull request numbers to the requests at
-.
+.
+
+
+Version 2.8.0
+-------------
+(not released yet)
+
+
+Version 2.7.4
+-------------
+(released January 12, 2021)
+
+- Updated lexers:
+
+ - Apache configurations: Improve handling of malformed tags (#1656)
+ - CSS: Add support for variables (#1633, #1666)
+ - Crystal (#1650, #1670)
+ - Coq (#1648)
+ - Fortran: Add missing keywords (#1635, #1665)
+ - Ini (#1624)
+ - JavaScript and variants (#1647 -- missing regex flags, #1651)
+ - Markdown (#1623, #1617)
+ - Shell
+
+ - Lex trailing whitespace as part of the prompt (#1645)
+ - Add missing ``in`` keyword (#1652)
+
+ - SQL - Fix keywords (#1668)
+ - Typescript: Fix incorrect punctuation handling (#1510, #1511)
+
+- Fix infinite loop in SML lexer (#1625)
+- Fix backtracking string regexes in JavaScript/TypeScript, Modula2
+ and many other lexers (#1637)
+- Limit recursion with nesting Ruby heredocs (#1638)
+- Fix a few inefficient regexes for guessing lexers
+- Fix the raw token lexer handling of Unicode (#1616)
+- Revert a private API change in the HTML formatter (#1655) --
+ please note that private APIs remain subject to change!
+- Fix several exponential/cubic-complexity regexes found by
+ Ben Caller/Doyensec (#1675)
+- Fix incorrect MATLAB example (#1582)
+
+Thanks to Google's OSS-Fuzz project for finding many of these bugs.
+
+
+Version 2.7.3
+-------------
+(released December 6, 2020)
+
+- Updated lexers:
+
+ * Ada (#1581)
+ * HTML (#1615, #1614)
+ * Java (#1594, #1586)
+ * JavaScript (#1605, #1589, #1588)
+ * JSON (#1569 -- this is a complete rewrite)
+ * Lean (#1601)
+ * LLVM (#1612)
+ * Mason (#1592)
+ * MySQL (#1555, #1551)
+ * Rust (#1608)
+ * Turtle (#1590, #1553)
+
+- Deprecated JsonBareObjectLexer, which is now identical to JsonLexer (#1600)
+- The ``ImgFormatter`` now calculates the exact character width, which fixes some issues with overlapping text (#1213, #1611)
+- Documentation fixes (#1609, #1599, #1598)
+- Fixed duplicated Juttle language alias (#1604, #1606)
+- Added support for Kotlin scripts (#1587)
+- Removed CSS rule which forced margin to 0
+
+
+Version 2.7.2
+-------------
+(released October 24, 2020)
+
+- Updated lexers:
+
+ * Latex (#1517, #1516)
+ * LLVM (#1565)
+ * SPARQL (#1559)
+
+- Fix Python console/traceback lexer problems with custom exceptions without messages (#1548)
+- Allow loading ttc fonts on Mac/image formatter (#1223)
+- Improve ``analyze_text`` across a variety of lexers (#1549)
+- Remove CSS rule which forced the vertical padding to 0 for line numbers (#1583, #1579)
+- Fix ``TNTLexer`` crashing on unexpected EOL (#1568, #1570)
+- ``regexlint`` can be now run locally as part of ``tox`` tests (#1557)
+- Fix typos (#1550, #1562)
+- Add Python 3.9 as a supported version (#1554)
+
+
+Version 2.7.1
+-------------
+(released September 16, 2020)
+
+- Fixed a regression in the JSON lexer (#1544)
+
+
+Version 2.7.0
+-------------
+(released September 12, 2020)
+
+- Added lexers:
+
+ * Arrow (#1481, #1499)
+ * BARE (#1488)
+ * Devicetree (#1434)
+ * F* (#1409)
+ * GDScript (#1457)
+ * Pointless (#1494)
+ * PromQL (#1506)
+ * PsySH (#1438)
+ * Singularity (#1285)
+ * TiddlyWiki5 (#1390)
+ * TNT (#1414)
+ * YANG (#1408, #1428)
+
+- Updated lexers:
+
+ * APL (#1503)
+ * C++ (#1350, which also fixes: #1222, #996, #906, #828, #1162, #1166,
+ #1396)
+ * Chapel (#1423)
+ * CMake (#1491)
+ * CSound (#1509)
+ * Cython (#1507)
+ * Dart (#1449)
+ * Fennel (#1535)
+ * Fortran (#1442)
+ * GAS (#1530)
+ * HTTP (#1432, #1520, #1521)
+ * Inform 6 (#1461)
+ * Javascript (#1533)
+ * JSON (#1065, #1528)
+ * Lean (#1415)
+ * Matlab (#1399)
+ * Markdown (#1492, #1495)
+ * MySQL (#975, #1063, #1453, #1527)
+ * NASM (#1465)
+ * Nim (#1426)
+ * PostgreSQL (#1513)
+ * PowerShell (#1398, #1497)
+ * Protobuf (#1505)
+ * Robot (#1480)
+ * SQL (#1402)
+ * SystemVerilog (#1436, #1452, #1454, #1460, #1462, #1463, #1464, #1471, #1496, #1504)
+ * TeraTerm (#1337)
+ * XML (#1502)
+
+- Added a new filter for math symbols (#1406)
+- The Kconfig lexer will match Kconfig derivative names now (#1458)
+- Improved HTML formatter output (#1500)
+- ``.markdown`` is now recognized as an extension for Markdown files (#1476)
+- Fixed line number colors for Solarized (#1477, #1356)
+- Improvements to exception handling (#1478)
+- Improvements to tests (#1532, #1533, #1539)
+- Various code cleanups (#1536, #1537, #1538)
+
+
+Version 2.6.1
+-------------
+(released March 8, 2020)
+
+- This release fixes a packaging issue. No functional changes.
+
+
+Version 2.6
+-----------
+(released March 8, 2020)
+
+- Running Pygments on Python 2.x is no longer supported.
+ (The Python 2 lexer still exists.)
+
+- Added lexers:
+
+ * Linux kernel logs (#1310)
+ * LLVM MIR (#1361)
+ * MiniScript (#1397)
+ * Mosel (#1287, #1326)
+ * Parsing Expression Grammar (#1336)
+ * ReasonML (#1386)
+ * Ride (#1319, #1321)
+ * Sieve (#1257)
+ * USD (#1290)
+ * WebIDL (#1309)
+
+- Updated lexers:
+
+ * Apache2 (#1378)
+ * Chapel (#1357)
+ * CSound (#1383)
+ * D (#1375, #1362)
+ * Haskell (#1347, #1177)
+ * Idris (#1360)
+ * Perl6/Raku lexer (#1344)
+ * Python3 (#1382, #1385)
+ * Rust: Updated lexer to cover more builtins (mostly macros) and miscellaneous
+ new syntax (#1320)
+ * SQL: Add temporal support keywords (#1402)
+
+- The 256-color/true-color terminal formatters now support the italic attribute
+ in styles (#1288)
+- Support HTTP 2/3 header (#1308)
+- Support missing reason in HTTP header (#1322)
+- Boogie/Silver: support line continuations and triggers, move contract keywords
+ to separate category (#1299)
+- GAS: support C-style comments (#1291)
+- Fix names in S lexer (#1330, #1333)
+- Fix numeric literals in Ada (#1334)
+- Recognize ``.mjs`` files as Javascript (#1392)
+- Recognize ``.eex`` files as Elixir (#1387)
+- Fix ``re.MULTILINE`` usage (#1388)
+- Recognize ``pipenv`` and ``poetry`` dependency & lock files (PR#1376)
+- Improve font search on Windows (#1247)
+- Remove unused script block (#1401)
+
+
+Version 2.5.2
+-------------
+(released November 29, 2019)
+
+- Fix incompatibility with some setuptools versions (PR#1316)
+
+- Fix lexing of ReST field lists (PR#1279)
+- Fix lexing of Matlab keywords as field names (PR#1282)
+- Recognize double-quoted strings in Matlab (PR#1278)
+- Avoid slow backtracking in Vim lexer (PR#1312)
+- Fix Scala highlighting of types (PR#1315)
+- Highlight field lists more consistently in ReST (PR#1279)
+- Fix highlighting Matlab keywords in field names (PR#1282)
+- Recognize Matlab double quoted strings (PR#1278)
+- Add some Terraform keywords
+- Update Modelica lexer to 3.4
+- Update Crystal examples
+
+
+Version 2.5.1
+-------------
+(released November 26, 2019)
+
+- This release fixes a packaging issue. No functional changes.
+
+
+Version 2.5.0
+-------------
+(released November 26, 2019)
+
+- Added lexers:
+
+ * Email (PR#1246)
+ * Erlang, Elixir shells (PR#823, #1521)
+ * Notmuch (PR#1264)
+ * `Scdoc `_ (PR#1268)
+ * `Solidity `_ (#1214)
+ * `Zeek `_ (new name for Bro) (PR#1269)
+ * `Zig `_ (PR#820)
+
+- Updated lexers:
+
+ * Apache2 Configuration (PR#1251)
+ * Bash sessions (#1253)
+ * CSound (PR#1250)
+ * Dart
+ * Dockerfile
+ * Emacs Lisp
+ * Handlebars (PR#773)
+ * Java (#1101, #987)
+ * Logtalk (PR#1261)
+ * Matlab (PR#1271)
+ * Praat (PR#1277)
+ * Python3 (PR#1255, PR#1400)
+ * Ruby
+ * YAML (#1528)
+ * Velocity
+
+- Added styles:
+
+ * Inkpot (PR#1276)
+
+- The ``PythonLexer`` class is now an alias for the former ``Python3Lexer``.
+ The old ``PythonLexer`` is available as ``Python2Lexer``. Same change has
+ been done for the ``PythonTracebackLexer``. The ``python3`` option for
+ the ``PythonConsoleLexer`` is now true by default.
+
+- Bump ``NasmLexer`` priority over ``TasmLexer`` for ``.asm`` files
+ (fixes #1326)
+- Default font in the ``ImageFormatter`` has been updated (#928, PR#1245)
+- Test suite switched to py.test, removed nose dependency (#1490)
+- Reduce ``TeraTerm`` lexer score -- it used to match nearly all languages
+ (#1256)
+- Treat ``Skylark``/``Starlark`` files as Python files (PR#1259)
+- Image formatter: actually respect ``line_number_separator`` option
+
+- Add LICENSE file to wheel builds
+- Agda: fix lambda highlighting
+- Dart: support ``@`` annotations
+- Dockerfile: accept ``FROM ... AS`` syntax
+- Emacs Lisp: add more string functions
+- GAS: accept registers in directive arguments
+- Java: make structural punctuation (braces, parens, colon, comma) ``Punctuation``, not ``Operator`` (#987)
+- Java: support ``var`` contextual keyword (#1101)
+- Matlab: Fix recognition of ``function`` keyword (PR#1271)
+- Python: recognize ``.jy`` filenames (#976)
+- Python: recognize ``f`` string prefix (#1156)
+- Ruby: support squiggly heredocs
+- Shell sessions: recognize Virtualenv prompt (PR#1266)
+- Velocity: support silent reference syntax
+
+
+Version 2.4.2
+-------------
+(released May 28, 2019)
+
+- Fix encoding error when guessing lexer with given ``encoding`` option
+ (#1438)
+
+
+Version 2.4.1
+-------------
+(released May 24, 2019)
+
+- Updated lexers:
+
+ * Coq (#1430)
+ * MSDOS Session (PR#734)
+ * NASM (#1517)
+ * Objective-C (PR#813, #1508)
+ * Prolog (#1511)
+ * TypeScript (#1515)
+
+- Support CSS variables in stylesheets (PR#814, #1356)
+- Fix F# lexer name (PR#709)
+- Fix ``TerminalFormatter`` using bold for bright text (#1480)
+
+
+Version 2.4.0
+-------------
+(released May 8, 2019)
+
+- Added lexers:
+
+ * Augeas (PR#807)
+ * BBC Basic (PR#806)
+ * Boa (PR#756)
+ * Charm++ CI (PR#788)
+ * DASM16 (PR#807)
+ * FloScript (PR#750)
+ * FreeFem++ (PR#785)
+ * Hspec (PR#790)
+ * Pony (PR#627)
+ * SGF (PR#780)
+ * Slash (PR#807)
+ * Slurm (PR#760)
+ * Tera Term Language (PR#749)
+ * TOML (PR#807)
+ * Unicon (PR#731)
+ * VBScript (PR#673)
+
+- Updated lexers:
+
+ * Apache2 (PR#766)
+ * Cypher (PR#746)
+ * LLVM (PR#792)
+ * Makefiles (PR#766)
+ * PHP (#1482)
+ * Rust
+ * SQL (PR#672)
+ * Stan (PR#774)
+ * Stata (PR#800)
+ * Terraform (PR#787)
+ * YAML
+
+- Add solarized style (PR#708)
+- Add support for Markdown reference-style links (PR#753)
+- Add license information to generated HTML/CSS files (#1496)
+- Change ANSI color names (PR#777)
+- Fix catastrophic backtracking in the bash lexer (#1494)
+- Fix documentation failing to build using Sphinx 2.0 (#1501)
+- Fix incorrect links in the Lisp and R lexer documentation (PR#775)
+- Fix rare unicode errors on Python 2.7 (PR#798, #1492)
+- Fix lexers popping from an empty stack (#1506)
+- TypoScript uses ``.typoscript`` now (#1498)
+- Updated Trove classifiers and ``pip`` requirements (PR#799)
+
+
Version 2.3.1
-------------
@@ -30,6 +414,7 @@ Version 2.3.1
- Fix invalid string escape sequences
- Fix `FutureWarning` introduced by regex changes in Python 3.7
+
Version 2.3.0
-------------
(released Nov 25, 2018)
@@ -613,7 +998,7 @@ Version 1.4
- Support ``application/javascript`` as a JavaScript mime type (#504).
-- Support `Offload `_ C++ Extensions as
+- Support `Offload `_ C++ Extensions as
keywords in the C++ lexer (#484).
- Escape more characters in LaTeX output (#505).
diff --git a/Contributing.md b/Contributing.md
new file mode 100644
index 0000000000..b66ba71752
--- /dev/null
+++ b/Contributing.md
@@ -0,0 +1,44 @@
+Licensing
+=========
+
+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.
+
+Contribution checklist
+======================
+
+* Check the documentation for how to write
+ [a new lexer](https://pygments.org/docs/lexerdevelopment/),
+ [a new formatter](https://pygments.org/docs/formatterdevelopment/) or
+ [a new filter](https://pygments.org/docs/filterdevelopment/)
+* When writing rules, try to merge simple rules. For instance, combine:
+
+ ```python
+ _PUNCTUATION = [
+ (r"\(", token.Punctuation),
+ (r"\)", token.Punctuation),
+ (r"\[", token.Punctuation),
+ (r"\]", token.Punctuation),
+ ("{", token.Punctuation),
+ ("}", token.Punctuation),
+ ]
+ ```
+
+ into:
+
+ ```python
+ (r"[\(\)\[\]{}]", token.Punctuation)
+ ```
+* Be careful with ``.*``. This matches greedily as much as it can. For instance,
+ rule like ``@.*@`` will match the whole string ``@first@ second @third@``,
+ instead of matching ``@first@`` and ``@second@``. You can use ``@.*?@`` in
+ this case to stop early. The ``?`` tries to match _as few times_ as possible.
+* Don't add imports of your lexer anywhere in the codebase. (In case you're
+ curious about ``compiled.py`` -- this file exists for backwards compatibility
+ reasons.)
+* Use the standard importing convention: ``from token import Punctuation``
+* If you have a tricky case, you can use the ``testcase`` formatter to produce
+ an unit test quickly. Run
+ ``python -m pygments -l lua -f testcase <<< "local a = 5"``. This will
+ produce a test case function skeleton.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 21815527ff..e1b15663d9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2017 by the respective authors (see AUTHORS file).
+Copyright (c) 2006-2021 by the respective authors (see AUTHORS file).
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/MANIFEST.in b/MANIFEST.in
index 7e1d320d27..c6a8567d25 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,5 @@
-include pygmentize
+include Makefile CHANGES LICENSE AUTHORS
include external/*
-include Makefile CHANGES LICENSE AUTHORS TODO
recursive-include tests *
recursive-include doc *
recursive-include scripts *
diff --git a/Makefile b/Makefile
index 878b94b715..be3e12a9cd 100644
--- a/Makefile
+++ b/Makefile
@@ -4,33 +4,33 @@
#
# Combines scripts for common tasks.
#
-# :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+# :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
# :license: BSD, see LICENSE for details.
#
-PYTHON ?= python
+PYTHON ?= python3
export PYTHONPATH = $(shell echo "$$PYTHONPATH"):$(shell python -c 'import os; print ":".join(os.path.abspath(line.strip()) for line in file("PYTHONPATH"))' 2>/dev/null)
.PHONY: all check clean clean-pyc codetags docs mapfiles \
- pylint reindent test test-coverage
+ pylint reindent test test-coverage test-examplefiles \
+ tox-test tox-test-coverage regexlint
all: clean-pyc check test
check:
+ @$(PYTHON) scripts/check_crlf.py pygments build external
@$(PYTHON) scripts/detect_missing_analyse_text.py || true
@pyflakes pygments | grep -v 'but unused' || true
@$(PYTHON) scripts/check_sources.py -i build -i dist -i pygments/lexers/_mapping.py \
-i docs/build -i pygments/formatters/_mapping.py -i pygments/unistring.py
clean: clean-pyc
- -rm -rf build
+ -rm -rf doc/_build build Pygments.egg-info tests/examplefiles/output
-rm -f codetags.html
clean-pyc:
- find . -name '*.pyc' -exec rm -f {} +
- find . -name '*.pyo' -exec rm -f {} +
- find . -name '*~' -exec rm -f {} +
+ find . -name '__pycache__' -exec rm -rf {} +
codetags:
@$(PYTHON) scripts/find_codetags.py -i tests/examplefiles -i scripts/pylintrc \
@@ -49,14 +49,16 @@ pylint:
reindent:
@$(PYTHON) scripts/reindent.py -r -B .
+TEST = tests
+
test:
- @$(PYTHON) tests/run.py -d $(TEST)
+ @$(PYTHON) `which py.test` $(TEST)
test-coverage:
- @$(PYTHON) tests/run.py -d --with-coverage --cover-package=pygments --cover-erase $(TEST)
+ @$(PYTHON) `which py.test` --cov --cov-report=html --cov-report=term $(TEST)
test-examplefiles:
- nosetests tests/test_examplefiles.py
+ @$(PYTHON) `which py.test` tests.test_examplefiles
tox-test:
@tox -- $(TEST)
diff --git a/README.rst b/README.rst
index 350e242ee7..6b7be278bc 100644
--- a/README.rst
+++ b/README.rst
@@ -1,19 +1,20 @@
-README for Pygments
+Welcome to Pygments
===================
-This is the source of Pygments. It is a generic syntax highlighter that
-supports over 300 languages and text formats, for use in code hosting, forums,
-wikis or other applications that need to prettify source code.
+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 ``python setup.py install``.
+... 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 http://pygments.org/ or created by ::
+... can be found online at https://pygments.org/ or created with Sphinx by ::
cd doc
make html
@@ -21,19 +22,23 @@ Documentation
Development
-----------
-... takes place on `Bitbucket
-`_, where the Mercurial
-repository, tickets and pull requests can be viewed.
+... takes place on `GitHub `_, where the
+Git repository, tickets and pull requests can be viewed.
-Continuous testing runs on drone.io:
+Continuous testing runs on GitHub workflows:
-.. image:: https://drone.io/bitbucket.org/birkenfeld/pygments-main/status.png
- :target: https://drone.io/bitbucket.org/birkenfeld/pygments-main
+.. image:: https://github.com/pygments/pygments/workflows/Pygments/badge.svg
+ :target: https://github.com/pygments/pygments/actions?query=workflow%3APygments
The authors
-----------
-Pygments is maintained by **Georg Brandl**, e-mail address *georg*\ *@*\ *python.org*.
+Pygments is maintained by **Georg Brandl**, e-mail address *georg*\ *@*\ *python.org*
+and **Matthäus Chajdas**.
Many lexers and fixes have been contributed by **Armin Ronacher**, the rest of
-the `Pocoo `_ team and **Tim Hatch**.
+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.
diff --git a/TODO b/TODO
deleted file mode 100644
index 88076f3df3..0000000000
--- a/TODO
+++ /dev/null
@@ -1,12 +0,0 @@
-Todo
-====
-
-- lexers that need work:
- * review perl lexer (numerous bugs, but so far no one had complaints ;)
- * readd property support for C# lexer? that is, find a regex that doesn't
- backtrack to death...
- * add support for function name highlighting to C++ lexer
-
-- allow "overlay" token types to highlight specials: nth line, a word etc.
-
-- pygmentize option presets, more sophisticated method to output styles?
diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml
deleted file mode 100644
index fc745f0fd4..0000000000
--- a/bitbucket-pipelines.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-pipelines:
- default:
- - step:
- name: Test on Python 2.7
- image: python:2.7
- caches:
- - pip
- script:
- - pip install -r requirements.txt
- - tox -e py27
- - step:
- name: Test on Python 3.4
- image: python:3.4
- caches:
- - pip
- script:
- - pip install -r requirements.txt
- - tox -e py34
- - step:
- name: Test on Python 3.6
- image: python:3.6
- caches:
- - pip
- script:
- - pip install -r requirements.txt
- - tox -e py36
- - step:
- name: Test on Python 3.7
- image: python:3.7
- caches:
- - pip
- script:
- - pip install -r requirements.txt
- - tox -e py37
diff --git a/doc/_static/demo.css b/doc/_static/demo.css
new file mode 100644
index 0000000000..90ceee2bc1
--- /dev/null
+++ b/doc/_static/demo.css
@@ -0,0 +1,47 @@
+#try {
+ background-color: #f6f6f6;
+ border-radius: 0;
+ border: 1px solid #ccc;
+ margin-top: 15px;
+ padding: 10px 15px 5px 10px;
+ position: relative;
+}
+
+#try h2 {
+ margin-top: 0;
+}
+
+#try textarea {
+ border: 1px solid #999;
+ padding: 2px;
+ width: 100%;
+ min-height: 150px;
+}
+
+#hlcode {
+ padding: 10px 0;
+}
+
+#hlcode pre {
+ background-color: transparent;
+ border-radius: 0;
+}
+
+#hlcodedl {
+ text-align: right;
+ padding: 0 15px;
+}
+
+#loading {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ margin: auto auto;
+ background-color: #cccccccc;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ text-align: center;
+}
diff --git a/doc/_static/demo.js b/doc/_static/demo.js
new file mode 100644
index 0000000000..1fc7a08197
--- /dev/null
+++ b/doc/_static/demo.js
@@ -0,0 +1,137 @@
+languagePluginLoader.then(() => {
+ // pyodide is now ready to use...
+ pyodide.loadPackage('Pygments').then(() => {
+ pyodide.runPython('import pygments.lexers, pygments.formatters.html, pygments.styles');
+
+ let qvars = getQueryVariables();
+
+ var lexerlist = pyodide.runPython('list(pygments.lexers.get_all_lexers())');
+ var sel = document.getElementById("lang");
+ for (lex of lexerlist) {
+ if (lex[1][0] === undefined) {
+ continue;
+ }
+ var opt = document.createElement("option");
+ opt.text = lex[0];
+ opt.value = lex[1][0];
+ sel.add(opt);
+ if (lex[1].indexOf(qvars['lexer']) >= 0) {
+ opt.selected = true;
+ }
+ }
+
+ var stylelist = pyodide.runPython('list(pygments.styles.get_all_styles())');
+ var sel = document.getElementById("style");
+ for (sty of stylelist) {
+ if (sty != "default") {
+ var opt = document.createElement("option");
+ opt.text = sty;
+ opt.value = sty;
+ sel.add(opt);
+ }
+ }
+
+ document.getElementById("hlbtn").disabled = false;
+ document.getElementById("loading").style.display = "none";
+
+ if (qvars['code'] !== undefined) {
+ document.getElementById("code").value = qvars['code'];
+ highlight();
+ }
+ });
+});
+
+function getQueryVariables() {
+ var query = window.location.search.substring(1);
+ var vars = query.split('&');
+ var var_obj = {};
+ for (var i = 0; i < vars.length; i++) {
+ var pair = vars[i].split('=');
+ var_obj[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
+ }
+ return var_obj;
+}
+
+function new_file() {
+ pyodide.globals['fname'] = document.getElementById("file").files[0].name;
+ var alias = pyodide.runPython('pygments.lexers.find_lexer_class_for_filename(fname).aliases[0]');
+ var sel = document.getElementById("lang");
+ for (var i = 0; i < sel.length; i++) {
+ if (sel.options[i].value == alias) {
+ sel.selectedIndex = i;
+ reset_err_hl();
+ break;
+ }
+ }
+}
+
+function reset_err_hl() {
+ document.getElementById("aroundlang").style.backgroundColor = null;
+}
+
+function highlight() {
+ var select = document.getElementById("lang");
+ var alias = select.options.item(select.selectedIndex).value
+
+ if (alias == "") {
+ document.getElementById("aroundlang").style.backgroundColor = "#ffcccc";
+ return;
+ }
+ pyodide.globals['alias'] = alias;
+
+ var select = document.getElementById("style");
+ pyodide.globals['style'] = select.options.item(select.selectedIndex).value;
+
+ pyodide.runPython('lexer = pygments.lexers.get_lexer_by_name(alias)');
+ pyodide.runPython('fmter = pygments.formatters.html.HtmlFormatter(noclasses=True, style=style)');
+
+ var file = document.getElementById("file").files[0];
+ if (file) {
+ file.arrayBuffer().then(function(buf) {
+ pyodide.globals['code_mem'] = buf;
+ pyodide.runPython('code = bytes(code_mem)');
+ document.getElementById("copy_btn").style.display = "none";
+ highlight_now();
+ });
+ } else {
+ var code = document.getElementById("code").value;
+ pyodide.globals['code'] = code;
+ var link = document.location.origin + document.location.pathname +
+ "?lexer=" + encodeURIComponent(alias) + "&code=" + encodeURIComponent(code);
+ document.getElementById("copy_field").value = link;
+ document.getElementById("copy_btn").style.display = "";
+ highlight_now();
+ }
+}
+
+function highlight_now() {
+ var out = document.getElementById("hlcode");
+ out.innerHTML = pyodide.runPython('pygments.highlight(code, lexer, fmter)');
+ document.location.hash = "#try";
+ document.getElementById("hlcodedl").style.display = "block";
+}
+
+function copy_link() {
+ var copy_field = document.getElementById("copy_field");
+ copy_field.select();
+ copy_field.setSelectionRange(0, 99999);
+ document.execCommand("copy");
+}
+
+function download_code() {
+ var filename = "highlighted.html";
+ var hlcode = document.getElementById("hlcode").innerHTML;
+ var blob = new Blob([hlcode], {type: 'text/html'});
+ if (window.navigator.msSaveOrOpenBlob) {
+ window.navigator.msSaveBlob(blob, filename);
+ }
+ else{
+ var elem = window.document.createElement('a');
+ elem.href = window.URL.createObjectURL(blob);
+ elem.download = filename;
+ document.body.appendChild(elem);
+ elem.click();
+ document.body.removeChild(elem);
+ window.URL.revokeObjectURL(elem.href);
+ }
+}
diff --git a/doc/_static/github.png b/doc/_static/github.png
new file mode 100644
index 0000000000..5d146adc0d
Binary files /dev/null and b/doc/_static/github.png differ
diff --git a/doc/_static/spinner.gif b/doc/_static/spinner.gif
new file mode 100644
index 0000000000..2212db9552
Binary files /dev/null and b/doc/_static/spinner.gif differ
diff --git a/doc/_templates/demo.html b/doc/_templates/demo.html
new file mode 100644
index 0000000000..912ab3d191
--- /dev/null
+++ b/doc/_templates/demo.html
@@ -0,0 +1,56 @@
+{% extends "layout.html" %}
+{% set sidebars = sidebars + ["demo_sidebar.html"] %}
+
+{% block extrahead %}
+{{ super() }}
+
+
+
+
+{% endblock %}
+
+{% block htmltitle %}Codestin Search App {% endblock %}
+
+{% block body %}
+{{ body }}
+
+Demo - Try it out!
+The highlighting here is performed in-browser using
+ a WebAssembly translation of the latest Pygments master branch, courtesy of
+ Pyodide .
+Your content is neither sent over the web nor stored anywhere.
+
+
+
Enter code and select a language
+
+
+
+
Loading Python...
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
diff --git a/doc/_templates/demo_sidebar.html b/doc/_templates/demo_sidebar.html
new file mode 100644
index 0000000000..3f2a86c698
--- /dev/null
+++ b/doc/_templates/demo_sidebar.html
@@ -0,0 +1 @@
+Back to top
diff --git a/doc/_templates/index_with_try.html b/doc/_templates/index_with_try.html
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/doc/_templates/indexsidebar.html b/doc/_templates/indexsidebar.html
index 299545541c..96d359d587 100644
--- a/doc/_templates/indexsidebar.html
+++ b/doc/_templates/indexsidebar.html
@@ -3,23 +3,22 @@ Download
This documentation is for version {{ version }} , which is
not released yet.
You can use it from the
- Mercurial repo or look for
- released versions in the Python
+ Git repo or look for
+ released versions in the Python
Package Index .
{% else %}
Current version: {{ version }}
-Get Pygments from the Python Package
-Index , or install it with:
+Get Pygments from the Python Package
+ Index , or install it with:
pip install Pygments
{% endif %}
Questions? Suggestions?
-Clone at Bitbucket
-or come to the #pocoo channel on FreeNode.
+
+ Clone at GitHub .
You can also open an issue at the
- tracker .
-
-A
- project
+ tracker .
+A
+ project
diff --git a/doc/_themes/pygments14/layout.html b/doc/_themes/pygments14/layout.html
index e88608272d..7523e918c6 100644
--- a/doc/_themes/pygments14/layout.html
+++ b/doc/_themes/pygments14/layout.html
@@ -17,7 +17,7 @@
{% block relbar2 %}{% endblock %}
{% block extrahead %}
-
{{ super() }}
{%- if not embedded %}
@@ -82,11 +82,11 @@
{% block footer %}
{# closes "outerwrapper" div #}
{% endblock %}
diff --git a/doc/_themes/pygments14/static/pygments14.css_t b/doc/_themes/pygments14/static/pygments14.css_t
index 7f09f6230d..d95f8c6811 100644
--- a/doc/_themes/pygments14/static/pygments14.css_t
+++ b/doc/_themes/pygments14/static/pygments14.css_t
@@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- pygments14 theme. Heavily copied from sphinx13.
*
- * :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ * :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
diff --git a/doc/conf.py b/doc/conf.py
index 51a916177d..f4d7484618 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -34,8 +34,8 @@
master_doc = 'index'
# General information about the project.
-project = u'Pygments'
-copyright = u'2015, Georg Brandl'
+project = 'Pygments'
+copyright = '2006-2021, Georg Brandl and Pygments contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -97,7 +97,7 @@
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
-#html_title = None
+html_title = 'Pygments'
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
@@ -125,12 +125,14 @@
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
-html_sidebars = {'index': 'indexsidebar.html',
- 'docs/*': 'docssidebar.html'}
+html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']}
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {}
+if os.environ.get('WEBSITE_BUILD'):
+ html_additional_pages = {
+ 'demo': 'demo.html',
+ }
# If false, no module index is generated.
#html_domain_indices = True
@@ -159,7 +161,7 @@
#html_file_suffix = None
# Output file base name for HTML help builder.
-htmlhelp_basename = 'Pygmentsdoc'
+htmlhelp_basename = 'Pygments'
# -- Options for LaTeX output --------------------------------------------------
@@ -178,8 +180,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'Pygments.tex', u'Pygments Documentation',
- u'Georg Brandl', 'manual'),
+ ('docs/index', 'Pygments.tex', 'Pygments Documentation',
+ 'Pygments authors', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -208,34 +210,21 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'pygments', u'Pygments Documentation',
- [u'Georg Brandl'], 1)
+ ('docs/index', 'pygments', 'Pygments Documentation',
+ ['Pygments authors'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
-# -- Options for Texinfo output ------------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- ('index', 'Pygments', u'Pygments Documentation',
- u'Georg Brandl', 'Pygments', 'One line description of project.',
- 'Miscellaneous'),
-]
-
-# Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
+# Example configuration for intersphinx: refer to the Python standard library.
+#intersphinx_mapping = {'http://docs.python.org/': None}
-# If false, no module index is generated.
-#texinfo_domain_indices = True
-# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
+def pg_context(app, pagename, templatename, ctx, event_arg):
+ ctx['demo_active'] = bool(os.environ.get('WEBSITE_BUILD'))
-# Example configuration for intersphinx: refer to the Python standard library.
-#intersphinx_mapping = {'http://docs.python.org/': None}
+def setup(app):
+ app.connect('html-page-context', pg_context)
diff --git a/doc/docs/index.rst b/doc/docs/index.rst
index 30d5c0851d..1c96e62d88 100644
--- a/doc/docs/index.rst
+++ b/doc/docs/index.rst
@@ -50,17 +50,12 @@ Pygments documentation
integrate
**About Pygments**
-
+
.. toctree::
:maxdepth: 1
changelog
authors
-
-If you find bugs or have suggestions for the documentation, please look
-:ref:`here ` for info on how to contact the team.
-
-.. XXX You can download an offline version of this documentation from the
- :doc:`download page `.
-
+If you find bugs or have suggestions for the documentation, please submit them
+on `GitHub `_.
diff --git a/doc/docs/integrate.rst b/doc/docs/integrate.rst
index 77daaa43c8..2a030b7be2 100644
--- a/doc/docs/integrate.rst
+++ b/doc/docs/integrate.rst
@@ -12,7 +12,7 @@ that uses Pygments to render source code in
:file:`external/markdown-processor.py`. You can copy and adapt it to your
liking.
-.. _Markdown: http://www.freewisdom.org/projects/python-markdown/
+.. _Markdown: https://pypi.org/project/Markdown/
TextMate
--------
@@ -20,7 +20,7 @@ TextMate
Antonio Cangiano has created a Pygments bundle for TextMate that allows to
colorize code via a simple menu option. It can be found here_.
-.. _here: http://antoniocangiano.com/2008/10/28/pygments-textmate-bundle/
+.. _here: https://programmingzen.com/pygments-textmate-bundle/
Bash completion
---------------
@@ -34,7 +34,7 @@ Wrappers for other languages
These libraries provide Pygments highlighting for users of other languages
than Python:
-* `pygments.rb `_, a pygments wrapper for Ruby
+* `pygments.rb `_, a pygments wrapper for Ruby
* `Clygments `_, a pygments wrapper for
Clojure
* `PHPygments `_, a pygments wrapper for PHP
diff --git a/doc/docs/java.rst b/doc/docs/java.rst
index f553463cdb..a8a5beb387 100644
--- a/doc/docs/java.rst
+++ b/doc/docs/java.rst
@@ -2,18 +2,18 @@
Use Pygments in Java
=====================
-Thanks to `Jython `_ it is possible to use Pygments in
+Thanks to `Jython `_ it is possible to use Pygments in
Java.
This page is a simple tutorial to get an idea of how this works. You can
-then look at the `Jython documentation `_ for more
+then look at the `Jython documentation `_ for more
advanced uses.
Since version 1.5, Pygments is deployed on `Maven Central
- `_ as a JAR, as is Jython
+ `_ as a JAR, as is Jython
which makes it a lot easier to create a Java project.
-Here is an example of a `Maven `_ ``pom.xml`` file for a
+Here is an example of a `Maven `_ ``pom.xml`` file for a
project running Pygments:
.. sourcecode:: xml
diff --git a/doc/docs/lexerdevelopment.rst b/doc/docs/lexerdevelopment.rst
index 63bd01a3e0..824e0c5931 100644
--- a/doc/docs/lexerdevelopment.rst
+++ b/doc/docs/lexerdevelopment.rst
@@ -20,7 +20,6 @@ containing tuples in the form ``(index, token, value)``. Normally you don't
need to do this since there are base lexers that do most of the work and that
you can subclass.
-
RegexLexer
==========
@@ -101,18 +100,21 @@ First, change the name of your lexer class to CustomLexer:
class CustomLexer(RegexLexer):
"""All your lexer code goes here!"""
-Then you can load the lexer from the command line with the additional
+Then you can load and test the lexer from the command line with the additional
flag ``-x``:
.. code-block:: console
- $ pygmentize -l your_lexer_file.py -x
+ $ python -m pygments -x -l your_lexer_file.py
To specify a class name other than CustomLexer, append it with a colon:
.. code-block:: console
- $ pygmentize -l your_lexer.py:SomeLexer -x
+ $ python -m pygments -x -l your_lexer.py:SomeLexer
+
+Use the ``-f`` flag to select a different output format than terminal
+escape sequences.
Or, using the Python API:
@@ -136,15 +138,20 @@ have to perform the following steps.
First, change to the current directory containing the Pygments source code. You
will need to have either an unpacked source tarball, or (preferably) a copy
-cloned from BitBucket.
+cloned from GitHub.
.. code-block:: console
- $ cd .../pygments-main
+ $ cd pygments
Select a matching module under ``pygments/lexers``, or create a new module for
your lexer class.
+.. note::
+
+ We encourage you to put your lexer class into its own module, unless it's a
+ very small derivative of an already existing lexer.
+
Next, make sure the lexer is known from outside of the module. All modules in
the ``pygments.lexers`` package specify ``__all__``. For example,
``esoteric.py`` sets::
@@ -164,16 +171,17 @@ To test the new lexer, store an example file with the proper extension in
``tests/examplefiles``. For example, to test your ``DiffLexer``, add a
``tests/examplefiles/example.diff`` containing a sample diff output.
-Now you can use pygmentize to render your example to HTML:
+Now you can use ``python -m pygments`` from the current root of the checkout to
+render your example to HTML:
.. code-block:: console
- $ ./pygmentize -O full -f html -o /tmp/example.html tests/examplefiles/example.diff
+ $ python -m pygments -O full -f html -o /tmp/example.html tests/examplefiles/example.diff
-Note that this explicitly calls the ``pygmentize`` in the current directory
-by preceding it with ``./``. This ensures your modifications are used.
-Otherwise a possibly already installed, unmodified version without your new
-lexer would have been called from the system search path (``$PATH``).
+Note that this explicitly calls the ``pygments`` module in the current
+directory. This ensures your modifications are used. Otherwise a possibly
+already installed, unmodified version without your new lexer would have been
+called from the system search path (``$PATH``).
To view the result, open ``/tmp/example.html`` in your browser.
@@ -196,7 +204,7 @@ defined, it defaults to `re.MULTILINE`. For more information about regular
expression flags see the page about `regular expressions`_ in the Python
documentation.
-.. _regular expressions: http://docs.python.org/library/re.html#regular-expression-syntax
+.. _regular expressions: https://docs.python.org/library/re.html#regular-expression-syntax
Scanning multiple tokens at once
@@ -555,7 +563,7 @@ appropriate positions. ::
class HtmlPhpLexer(DelegatingLexer):
def __init__(self, **options):
- super(HtmlPhpLexer, self).__init__(HtmlLexer, PhpLexer, **options)
+ super().__init__(HtmlLexer, PhpLexer, **options)
This procedure ensures that e.g. HTML with template tags in it is highlighted
correctly even if the template tags are put into HTML tags or attributes.
@@ -611,7 +619,7 @@ possibility to influence the position.
There are not really any simple examples for lexer callbacks, but you can see
them in action e.g. in the `SMLLexer` class in `ml.py`_.
-.. _ml.py: http://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/ml.py
+.. _ml.py: https://github.com/pygments/pygments/blob/master/pygments/lexers/ml.py
The ExtendedRegexLexer class
@@ -667,7 +675,7 @@ For example, this is how the hypothetical lexer above would be written with the
This might sound confusing (and it can really be). But it is needed, and for an
example look at the Ruby lexer in `ruby.py`_.
-.. _ruby.py: https://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/ruby.py
+.. _ruby.py: https://github.com/pygments/pygments/blob/master/pygments/lexers/ruby.py
Handling Lists of Keywords
diff --git a/doc/docs/moinmoin.rst b/doc/docs/moinmoin.rst
index 8b2216b3c4..80ed25c38d 100644
--- a/doc/docs/moinmoin.rst
+++ b/doc/docs/moinmoin.rst
@@ -36,4 +36,4 @@ If you do not want to do that and are willing to accept larger HTML output, you
can set the ``INLINESTYLES`` option to True.
-.. _Moin: http://moinmoin.wikiwikiweb.de/
+.. _Moin: https://moinmo.in/
diff --git a/doc/docs/plugins.rst b/doc/docs/plugins.rst
index a6f8d7b007..1008013aa0 100644
--- a/doc/docs/plugins.rst
+++ b/doc/docs/plugins.rst
@@ -7,7 +7,7 @@ use the lexer/formatter/style/filter lookup functions (`lexers.get_lexer_by_name
et al.), you can use `setuptools`_ entrypoints to add new lexers, formatters
or styles as if they were in the Pygments core.
-.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools
+.. _setuptools: https://pypi.org/project/setuptools/
That means you can use your highlighter modules with the `pygmentize` script,
which relies on the mentioned functions.
@@ -82,7 +82,7 @@ This documentation doesn't explain how to use those entrypoints because this is
covered in the `setuptools documentation`_. That page should cover everything
you need to write a plugin.
-.. _setuptools documentation: http://peak.telecommunity.com/DevCenter/setuptools
+.. _setuptools documentation: https://setuptools.readthedocs.io/en/latest/
Extending The Core
diff --git a/doc/docs/rstdirective.rst b/doc/docs/rstdirective.rst
index c0d503b3da..edc117d3a7 100644
--- a/doc/docs/rstdirective.rst
+++ b/doc/docs/rstdirective.rst
@@ -19,4 +19,4 @@ From Pygments 0.9, the directive is shipped in the distribution as
``.. code::`` directives and highlights the contents in the specified language
if the `handlecodeblocks` option is true.
-.. _ReST: http://docutils.sf.net/rst.html
+.. _ReST: https://docutils.sourceforge.io/rst.html
diff --git a/doc/docs/styles.rst b/doc/docs/styles.rst
index 1094a270f7..570293a5af 100644
--- a/doc/docs/styles.rst
+++ b/doc/docs/styles.rst
@@ -153,17 +153,17 @@ Terminal Styles
.. versionadded:: 2.2
Custom styles used with the 256-color terminal formatter can also map colors to
-use the 8 default ANSI colors. To do so, use ``#ansigreen``, ``#ansired`` or
+use the 8 default ANSI colors. To do so, use ``ansigreen``, ``ansibrightred`` or
any other colors defined in :attr:`pygments.style.ansicolors`. Foreground ANSI
colors will be mapped to the corresponding `escape codes 30 to 37
`_ thus respecting any
custom color mapping and themes provided by many terminal emulators. Light
variants are treated as foreground color with and an added bold flag.
-``bg:#ansi`` will also be respected, except the light variant will be the
+``bg:ansi`` will also be respected, except the light variant will be the
same shade as their dark variant.
See the following example where the color of the string ``"hello world"`` is
-governed by the escape sequence ``\x1b[34;01m`` (Ansi Blue, Bold, 41 being red
+governed by the escape sequence ``\x1b[34;01m`` (Ansi bright blue, Bold, 41 being red
background) instead of an extended foreground & background color.
.. sourcecode:: pycon
@@ -176,7 +176,7 @@ background) instead of an extended foreground & background color.
>>> class MyStyle(Style):
styles = {
- Token.String: '#ansiblue bg:#ansired',
+ Token.String: 'ansibrightblue bg:ansibrightred',
}
>>> code = 'print("Hello World")'
@@ -184,18 +184,49 @@ background) instead of an extended foreground & background color.
>>> print(result.encode())
b'\x1b[34;41;01m"\x1b[39;49;00m\x1b[34;41;01mHello World\x1b[39;49;00m\x1b[34;41;01m"\x1b[39;49;00m'
-Colors specified using ``#ansi*`` are converted to a default set of RGB colors
+Colors specified using ``ansi*`` are converted to a default set of RGB colors
when used with formatters other than the terminal-256 formatter.
By definition of ANSI, the following colors are considered "light" colors, and
will be rendered by most terminals as bold:
-- "darkgray", "red", "green", "yellow", "blue", "fuchsia", "turquoise", "white"
+- "brightblack" (darkgrey), "brightred", "brightgreen", "brightyellow", "brightblue",
+ "brightmagenta", "brightcyan", "white"
The following are considered "dark" colors and will be rendered as non-bold:
-- "black", "darkred", "darkgreen", "brown", "darkblue", "purple", "teal",
- "lightgray"
+- "black", "red", "green", "yellow", "blue", "magenta", "cyan",
+ "gray"
Exact behavior might depends on the terminal emulator you are using, and its
settings.
+
+.. _new-ansi-color-names:
+
+.. versionchanged:: 2.4
+
+The definition of the ANSI color names has changed.
+New names are easier to understand and align to the colors used in other projects.
+
+===================== ====================
+New names Pygments up to 2.3
+===================== ====================
+``ansiblack`` ``#ansiblack``
+``ansired`` ``#ansidarkred``
+``ansigreen`` ``#ansidarkgreen``
+``ansiyellow`` ``#ansibrown``
+``ansiblue`` ``#ansidarkblue``
+``ansimagenta`` ``#ansipurple``
+``ansicyan`` ``#ansiteal``
+``ansigray`` ``#ansilightgray``
+``ansibrightblack`` ``#ansidarkgray``
+``ansibrightred`` ``#ansired``
+``ansibrightgreen`` ``#ansigreen``
+``ansibrightyellow`` ``#ansiyellow``
+``ansibrightblue`` ``#ansiblue``
+``ansibrightmagenta`` ``#ansifuchsia``
+``ansibrightcyan`` ``#ansiturquoise``
+``ansiwhite`` ``#ansiwhite``
+===================== ====================
+
+Old ANSI color names are deprecated but will still work.
diff --git a/doc/download.rst b/doc/download.rst
index cf32f481a3..7ac0868062 100644
--- a/doc/download.rst
+++ b/doc/download.rst
@@ -7,8 +7,8 @@ Packaged versions
-----------------
You can download it `from the Python Package Index
-`_. For installation of packages from
-PyPI, we recommend `Pip `_, which works on all
+`_. For installation of packages from
+PyPI, we recommend `Pip `_, which works on all
major platforms.
Under Linux, most distributions include a package for Pygments, usually called
@@ -18,17 +18,15 @@ manager as usual.
Development sources
-------------------
-We're using the `Mercurial `_ version control
-system. You can get the development source using this command::
+We're using the Git version control system. You can get the development source
+using this command::
- hg clone http://bitbucket.org/birkenfeld/pygments-main pygments
+ git clone https://github.com/pygments/pygments
-Development takes place at `Bitbucket
-`_, you can browse the source
-online `here `_.
+Development takes place at `GitHub `_.
The latest changes in the development source code are listed in the `changelog
-`_.
+`_.
.. Documentation
-------------
@@ -36,6 +34,6 @@ The latest changes in the development source code are listed in the `changelog
.. XXX todo
You can download the documentation either as
- a bunch of rst files from the Mercurial repository, see above, or
+ a bunch of rst files from the Git repository, see above, or
as a tar.gz containing rendered HTML files:
pygmentsdocs.tar.gz
diff --git a/doc/faq.rst b/doc/faq.rst
index 172929e099..2e133b02a8 100644
--- a/doc/faq.rst
+++ b/doc/faq.rst
@@ -62,9 +62,9 @@ Please see the :doc:`documentation on styles `.
How can I report a bug or suggest a feature?
--------------------------------------------
-Please report bugs and feature wishes in the tracker at Bitbucket.
+Please report bugs and feature wishes in the tracker at GitHub.
-You can also e-mail the author or use IRC, see the contact details.
+You can also e-mail the authors, see the contact details.
I want this support for this language!
--------------------------------------
@@ -89,51 +89,53 @@ Who uses Pygments?
This is an (incomplete) list of projects and sites known to use the Pygments highlighter.
-* `Wikipedia `_
-* `BitBucket `_, a Mercurial and Git hosting site
-* `The Sphinx documentation builder `_, for embedded source examples
-* `rst2pdf `_, a reStructuredText to PDF converter
-* `Codecov `_, a code coverage CI service
-* `Trac `_, the universal project management tool
-* `AsciiDoc `_, a text-based documentation generator
-* `ActiveState Code `_, the Python Cookbook successor
+* `Wikipedia `_
+* `BitBucket `_, a Mercurial and Git hosting site
+* `The Sphinx documentation builder `_, for embedded source examples
+* `rst2pdf `_, a reStructuredText to PDF converter
+* `Codecov `_, a code coverage CI service
+* `Trac `_, the universal project management tool
+* `AsciiDoc `_, a text-based documentation generator
+* `ActiveState Code `_, the Python Cookbook successor
* `ViewVC `_, a web-based version control repository browser
-* `BzrFruit `_, a Bazaar branch viewer
+* `BzrFruit `_, a Bazaar branch viewer
* `QBzr `_, a cross-platform Qt-based GUI front end for Bazaar
-* `Review Board `_, a collaborative code reviewing tool
-* `Diamanda `_, a Django powered wiki system with support for Pygments
+* `Review Board `_, a collaborative code reviewing tool
+* `Diamanda `_, a Django powered wiki system with support for Pygments
* `Progopedia `_ (`English `_),
an encyclopedia of programming languages
-* `Bruce `_, a reStructuredText presentation tool
+* `Bruce `_, a reStructuredText presentation tool
* `PIDA `_, a universal IDE written in Python
-* `BPython `_, a curses-based intelligent Python shell
-* `PuDB `_, a console Python debugger
-* `XWiki `_, a wiki-based development framework in Java, using Jython
+* `BPython `_, a curses-based intelligent Python shell
+* `PuDB `_, a console Python debugger
+* `XWiki `_, a wiki-based development framework in Java, using Jython
* `roux `_, a script for running R scripts
and creating beautiful output including graphs
* `hurl `_, a web service for making HTTP requests
* `wxHTMLPygmentizer `_ is
a GUI utility, used to make code-colorization easier
-* `Postmarkup `_, a BBCode to XHTML generator
+* `Postmarkup `_, a BBCode to XHTML generator
* `WpPygments `_, and `WPygments
`_, highlighter plugins for WordPress
* `Siafoo `_, a tool for sharing and storing useful code and programming experience
* `D source `_, a community for the D programming language
* `dpaste.com `_, another Django pastebin
-* `Django snippets `_, a pastebin for Django code
+* `Django snippets `_, a pastebin for Django code
* `Fayaa `_, a Chinese pastebin
* `Incollo.com `_, a free collaborative debugging tool
-* `PasteBox `_, a pastebin focused on privacy
+* `PasteBox `_, a pastebin focused on privacy
* `hilite.me `_, a site to highlight code snippets
* `patx.me `_, a pastebin
* `Fluidic `_, an experiment in
integrating shells with a GUI
-* `pygments.rb `_, a pygments wrapper for Ruby
+* `pygments.rb `_, a pygments wrapper for Ruby
* `Clygments `_, a pygments wrapper for
Clojure
* `PHPygments `_, a pygments wrapper for PHP
+* `Spyder `_, the Scientific Python Development
+ Environment, uses pygments for the multi-language syntax highlighting in its
+ `editor `_.
+* `snippet.host `_, minimal text and code snippet hosting
-
-If you have a project or web site using Pygments, drop me a line, and I'll add a
-link here.
-
+If you have a project or web site using Pygments, `open an issue or PR
+`_ and we'll add a line here.
diff --git a/doc/index.rst b/doc/index.rst
index 261140459f..4495943a7a 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -5,17 +5,16 @@ This is the home of Pygments. It is a generic syntax highlighter suitable for
use in code hosting, forums, wikis or other applications that need to prettify
source code. Highlights are:
-* a wide range of over 300 languages and other text formats is supported
+* a wide range of over 500 languages and other text formats is supported
* special attention is paid to details that increase highlighting quality
* support for new languages and formats are added easily; most languages use a
simple regex-based lexing mechanism
* a number of output formats is available, among them HTML, RTF, LaTeX and ANSI
sequences
* it is usable as a command-line tool and as a library
-* ... and it highlights even Perl 6!
Read more in the :doc:`FAQ list ` or the :doc:`documentation `,
-or `download the latest release `_.
+or `download the latest release `_.
.. _contribute:
@@ -26,15 +25,9 @@ Like every open-source project, we are always looking for volunteers to help us
with programming. Python knowledge is required, but don't fear: Python is a very
clear and easy to learn language.
-Development takes place on `Bitbucket
-`_, where the Mercurial
-repository, tickets and pull requests can be viewed.
+Development takes place on `GitHub `_.
-Our primary communication instrument is the IRC channel **#pocoo** on the
-Freenode network. To join it, let your IRC client connect to
-``irc.freenode.net`` and do ``/join #pocoo``.
-
-If you found a bug, just open a ticket in the Bitbucket tracker. Be sure to log
+If you found a bug, just open a ticket in the GitHub tracker. Be sure to log
in to be notified when the issue is fixed -- development is not fast-paced as
the library is quite stable. You can also send an e-mail to the developers, see
below.
@@ -42,10 +35,11 @@ below.
The authors
-----------
-Pygments is maintained by **Georg Brandl**, e-mail address *georg*\ *@*\ *python.org*.
+Pygments is maintained by **Georg Brandl**, e-mail address *georg*\ *@*\ *python.org*
+and **Matthäus Chajdas**.
Many lexers and fixes have been contributed by **Armin Ronacher**, the rest of
-the `Pocoo `_ team and **Tim Hatch**.
+the `Pocoo `_ team and **Tim Hatch**.
.. toctree::
:maxdepth: 1
diff --git a/doc/languages.rst b/doc/languages.rst
index e5399403ba..34cb95e2ad 100644
--- a/doc/languages.rst
+++ b/doc/languages.rst
@@ -8,149 +8,348 @@ Pygments supports an ever-growing range of languages. Watch this space...
Programming languages
---------------------
-* ActionScript
-* Ada
-* ANTLR
-* AppleScript
-* Assembly (various)
-* Asymptote
-* Awk
-* Befunge
-* Boo
-* BrainFuck
-* C, C++
-* C#
-* Clojure
-* CoffeeScript
-* ColdFusion
-* Common Lisp
-* Coq
-* Cryptol (incl. Literate Cryptol)
-* `Crystal `_
-* `Cython `_
-* `D `_
-* Dart
-* Delphi
-* Dylan
-* `Elm `_
-* Erlang
-* `Ezhil `_ Ezhil - A Tamil programming language
-* Factor
-* Fancy
+* `ActionScript `_
+* `Ada `_
+* `Agda `_ (incl. literate)
+* `Alloy `_
+* `AMPL `_
+* `ANTLR `_
+* `APL `_
+* `AppleScript `_
+* `Assembly `_ (various)
+* `Asymptote `_
+* `Augeas `_
+* `AutoIt `_
+* `Awk `_
+* `BARE `_
+* `BBC Basic `_
+* `Befunge `_
+* `BlitzBasic `_
+* `Boa `_
+* `Boo `_
+* `Boogie `_
+* `BrainFuck `_
+* `C `_, `C++ `_ (incl. dialects like Arduino)
+* `C# `_
+* `Chapel `_
+* `Charm++ CI `_
+* `Cirru `_
+* `Clay `_
+* `Clean `_
+* `Clojure `_
+* `CoffeeScript `_
+* `ColdFusion `_
+* `Common Lisp `_
+* `Component Pascal `_
+* `Coq `_
+* `Croc `_ (MiniD)
+* `Cryptol `_ (incl. Literate Cryptol)
+* `Crystal `_
+* `Cypher `_
+* `Cython `_
+* `D `_
+* `Dart `_
+* DCPU-16
+* `Delphi `_
+* `Devicetree `_
+* `Dylan `_ (incl. console)
+* `Eiffel `_
+* `Elm `_
+* `Emacs Lisp `_
+* Email
+* `Erlang `_ (incl. shell sessions)
+* `Ezhil `_
+* `Execline `_
+* `Factor `_
+* `Fancy `_
+* `Fantom `_
* `Fennel `_
-* Fortran
-* F#
-* GAP
-* Gherkin (Cucumber)
-* GL shaders
-* Groovy
-* `Haskell `_ (incl. Literate Haskell)
-* HLSL
-* IDL
-* Io
-* Java
-* JavaScript
-* Lasso
-* LLVM
-* Logtalk
-* `Lua `_
-* Matlab
-* MiniD
-* Modelica
-* Modula-2
-* MuPad
-* Nemerle
-* Nimrod
-* Objective-C
-* Objective-J
-* Octave
-* OCaml
-* PHP
-* `Perl `_
-* PovRay
-* PostScript
-* PowerShell
-* Prolog
-* `Python `_ 2.x and 3.x (incl. console sessions and tracebacks)
+* `FloScript `_
+* `Fortran `_
+* `FreeFEM++ `_
+* `F# `_
+* `F* `_
+* `GAP `_
+* `GDScript `_
+* `Gherkin `_ (Cucumber)
+* `GLSL `_ shaders
+* `GnuCOBOL `_ (OpenCOBOL)
+* `Golo `_
+* `Gosu `_
+* `Groovy `_
+* `Haskell `_ (incl. Literate Haskell)
+* `Haxe `_
+* `HLSL `_ shaders
+* `HSpec `_
+* `Hy `_
+* `IDL `_
+* `Idris `_ (incl. Literate Idris)
+* `Igor Pro `_
+* `Io `_
+* `Jags `_
+* `Java `_
+* `JavaScript `_
+* `Jasmin `_
+* `Jcl `_
+* `Julia `_
+* `Kotlin `_
+* `Lasso `_ (incl. templating)
+* `Limbo `_
+* `LiveScript `_
+* `LLVM MIR `_
+* `Logtalk `_
+* `Logos `_
+* `Lua `_
+* `Mathematica `_
+* `Matlab `_
+* `MiniScript `_
+* `Modelica `_
+* `Modula-2 `_
+* `Monkey `_
+* `Monte `_
+* `MoonScript `_
+* `Mosel `_
+* `MuPad `_
+* `NASM `_
+* `Nemerle `_
+* `NesC `_
+* `NewLISP `_
+* `Nim `_
+* `Nit `_
+* `Notmuch `_
+* `NuSMV `_
+* `Objective-C `_
+* `Objective-J `_
+* `Octave `_
+* `OCaml `_
+* `Opa `_
+* `ParaSail `_
+* `Pawn `_
+* `PHP `_
+* `Perl 5 `_
+* `Pike `_
+* `Pointless `_
+* `Pony `_
+* `PovRay `_
+* `PostScript `_
+* `PowerShell `_
+* `Praat `_
+* `Prolog `_
+* `Python `_ 2.x and 3.x (incl. console sessions and
+ tracebacks)
+* `QBasic `_
+* `Racket `_
+* `Raku `_ a.k.a. Perl 6
+* `ReasonML `_
* `REBOL `_
-* `Red `_
-* Redcode
-* `Ruby `_ (incl. irb sessions)
-* Rust
-* S, S-Plus, R
-* Scala
-* Scheme
-* Scilab
-* Smalltalk
-* SNOBOL
-* Tcl
-* Vala
-* Verilog
-* VHDL
-* Visual Basic.NET
-* Visual FoxPro
-* XQuery
-* Zephir
+* `Red `_
+* `Redcode `_
+* `Rexx `_
+* `Ride `_
+* `Ruby `_ (incl. irb sessions)
+* `Rust `_
+* S, S-Plus, `R `_
+* `Scala `_
+* `Scdoc `_
+* `Scheme `_
+* `Scilab `_
+* `SGF `_
+* Shell scripts (`Bash `_, `Tcsh `_, `Fish `_)
+* `Shen `_
+* `Silver `_
+* `Slash `_
+* `Slurm `_
+* `Smalltalk `_
+* `SNOBOL `_
+* `Snowball `_
+* `Solidity `_
+* `SourcePawn `_
+* `Stan `_
+* `Standard ML `_
+* `Stata `_
+* `Swift `_
+* `Swig `_
+* `SuperCollider `_
+* `Tcl `_
+* `Tera Term language `_
+* `TypeScript `_
+* `TypoScript `_
+* `USD `_
+* `Unicon `_
+* `Urbiscript `_
+* `Vala `_
+* `VBScript `_
+* Verilog, `SystemVerilog `_
+* `VHDL `_
+* `Visual Basic.NET `_
+* `Visual FoxPro `_
+* `Whiley `_
+* `Xtend `_
+* `XQuery `_
+* `Zeek `_
+* `Zephir `_
+* `Zig `_
Template languages
------------------
-* Cheetah templates
-* `Django `_ / `Jinja
- `_ templates
-* ERB (Ruby templating)
-* `Genshi `_ (the Trac template language)
-* JSP (Java Server Pages)
-* `Myghty `_ (the HTML::Mason based framework)
-* `Mako `_ (the Myghty successor)
-* `Smarty `_ templates (PHP templating)
-* Tea
+* `Angular templates `_
+* `Cheetah templates `_
+* `ColdFusion `_
+* `Django `_ / `Jinja
+ `_ templates
+* `ERB `_ (Ruby templating)
+* Evoque
+* `Genshi `_ (the Trac template language)
+* `Handlebars `_
+* `JSP `_ (Java Server Pages)
+* `Liquid `_
+* `Myghty `_ (the HTML::Mason based framework)
+* `Mako `_ (the Myghty successor)
+* `Slim `_
+* `Smarty `_ templates (PHP templating)
+* `Tea `_
+* `Twig `_
Other markup
------------
* Apache config files
-* Bash shell scripts
+* Apache Pig
* BBCode
+* CapDL
+* `Cap'n Proto `_
* CMake
+* `Csound `_ scores
* CSS
* Debian control files
* Diff files
+* Dockerfiles
* DTD
+* EBNF
+* E-mail headers
+* Extempore
+* Flatline
* Gettext catalogs
* Gnuplot script
* Groff markup
+* Hexdumps
* HTML
* HTTP sessions
+* IDL
+* Inform
* INI-style config files
* IRC logs (irssi style)
+* Isabelle
+* JSGF notation
+* JSON, JSON-LD
+* Lean theorem prover
* Lighttpd config files
+* Linux kernel log (dmesg)
+* LLVM assembly
+* LSL scripts
* Makefiles
* MoinMoin/Trac Wiki markup
+* MQL
* MySQL
+* NCAR command language
* Nginx config files
+* `Nix language `_
+* NSIS scripts
+* Notmuch
+* `PEG `_
* POV-Ray scenes
+* `PromQL `_
+* `Puppet `_
+* QML
* Ragel
* Redcode
* ReST
+* `Roboconf `_
* Robot Framework
* RPM spec files
+* Rql
+* RSL
+* Scdoc
+* Sieve
+* Singularity
+* SPARQL
* SQL, also MySQL, SQLite
* Squid configuration
+* TADS 3
+* Terraform
* TeX
-* tcsh
+* `Thrift `_
+* `TNT `_
+* `TOML `_
+* Treetop grammars
+* USD (Universal Scene Description)
+* Varnish configs
+* VGL
* Vim Script
+* WDiff
+* Web IDL
* Windows batch files
* XML
* XSLT
* YAML
+* YANG
+* Windows Registry files
+
+
+Interactive terminal/shell sessions
+-----------------------------------
+
+To highlight an interactive terminal or shell session, prefix your code snippet
+with a specially formatted prompt.
+
+Supported shells with examples are shown below. In each example, prompt parts in
+brackets ``[any]`` represent optional parts of the prompt, and prompt parts
+without brackets or in parenthesis ``(any)`` represent required parts of the
+prompt.
+
+* **Bash Session** (console, shell-session):
+
+ .. code-block:: console
+
+ [any@any]$ ls -lh
+ [any@any]# ls -lh
+ [any@any]% ls -lh
+ $ ls -lh
+ # ls -lh
+ % ls -lh
+ > ls -lh
+
+* **MSDOS Session** (doscon):
+
+ .. code-block:: doscon
+
+ [any]> dir
+ > dir
+ More? dir
+
+* **Tcsh Session** (tcshcon):
+
+ .. code-block:: tcshcon
+
+ (any)> ls -lh
+ ? ls -lh
+
+* **PowerShell Session** (ps1con):
+
+ .. code-block:: ps1con
+
+ PS[any]> Get-ChildItem
+ PS> Get-ChildItem
+ >> Get-ChildItem
+
... that's all?
---------------
-Well, why not write your own? Contributing to Pygments is easy and fun. Take a look at the
-:doc:`docs on lexer development ` and
-:ref:`contact details `.
+Well, why not write your own? Contributing to Pygments is easy and fun. Take a
+look at the :doc:`docs on lexer development `. Pull
+requests are welcome on `GitHub `_.
Note: the languages listed here are supported in the development version. The
latest release may lack a few of them.
diff --git a/external/autopygmentize b/external/autopygmentize
index d2d05970b6..8a2e7a6dbe 100755
--- a/external/autopygmentize
+++ b/external/autopygmentize
@@ -1,6 +1,6 @@
#!/bin/bash
# Best effort auto-pygmentization with transparent decompression
-# by Reuben Thomas 2008-2016
+# by Reuben Thomas 2008-2019
# This program is in the public domain.
# Strategy: first see if pygmentize can find a lexer; if not, ask file; if that finds nothing, fail
@@ -15,7 +15,7 @@ file_common_opts="--brief --dereference"
lexer=$(pygmentize -N "$file")
if [[ "$lexer" == text ]]; then
- unset lexer
+ # Try to do better than just "text"
case $(file --mime-type --uncompress $file_common_opts "$file") in
application/xml|image/svg+xml) lexer=xml;;
application/javascript) lexer=javascript;;
@@ -66,36 +66,42 @@ if [[ "$lexer" == text ]]; then
esac
fi
-# Find a preprocessor for compressed files
+# Find a concatenator for compressed files
concat=cat
case $(file $file_common_opts --mime-type "$file") in
- application/x-gzip) concat=zcat;;
+ application/gzip) concat=zcat;;
application/x-bzip2) concat=bzcat;;
application/x-xz) concat=xzcat;;
esac
-# Find a suitable lexer, preceded by a hex dump for binary files
+# Find a suitable reader, preceded by a hex dump for binary files,
+# or fmt for text with very long lines
prereader=""
+reader=cat
encoding=$(file --mime-encoding --uncompress $file_common_opts "$file")
-if [[ $encoding == "binary" ]]; then
- prereader="od -x" # POSIX fallback
- if [[ -n $(which hd) ]]; then
- prereader="hd" # preferred
- fi
- lexer=hexdump
- encoding=latin1
-fi
-if [[ -n "$lexer" ]]; then
+# FIXME: need a way to switch between hex and text view, as file often
+# misdiagnoses files when they contain a few control characters
+# if [[ $encoding == "binary" ]]; then
+# prereader="od -x" # POSIX fallback
+# if [[ -n $(which hd) ]]; then
+# prereader=hd # preferred
+# fi
+# lexer=hexdump
+# encoding=latin1
+#el
+# FIXME: Using fmt does not work well for system logs
+# if [[ "$lexer" == "text" ]]; then
+# if file "$file" | grep -ql "text, with very long lines"; then
+# reader=fmt
+# fi
+# fi
+if [[ "$lexer" != "text" ]]; then
reader="pygmentize -O inencoding=$encoding $PYGMENTIZE_OPTS $options -l $lexer"
fi
-# If we found a reader, run it
-if [[ -n "$reader" ]]; then
- if [[ -n "$prereader" ]]; then
- exec $concat "$file" | $prereader | $reader
- else
- exec $concat "$file" | $reader
- fi
+# Run the reader
+if [[ -n "$prereader" ]]; then
+ exec $concat "$file" | $prereader | $reader
+else
+ exec $concat "$file" | $reader
fi
-
-exit 1
diff --git a/external/markdown-processor.py b/external/markdown-processor.py
index cb8d793d76..8d1afbbb88 100644
--- a/external/markdown-processor.py
+++ b/external/markdown-processor.py
@@ -22,7 +22,7 @@
.. _Markdown: https://pypi.python.org/pypi/Markdown
- :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/external/moin-parser.py b/external/moin-parser.py
index 03a7c3c3e6..b8d62f401c 100644
--- a/external/moin-parser.py
+++ b/external/moin-parser.py
@@ -31,7 +31,7 @@
If you do not want to do that and are willing to accept larger HTML
output, you can set the INLINESTYLES option below to True.
- :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/external/rst-directive.py b/external/rst-directive.py
index de26dd03da..904625611f 100644
--- a/external/rst-directive.py
+++ b/external/rst-directive.py
@@ -27,11 +27,11 @@
Look at the `directive documentation`_ to get all the gory details.
- .. _Docutils: http://docutils.sf.net/
+ .. _Docutils: https://docutils.sourceforge.io/
.. _directive documentation:
- http://docutils.sourceforge.net/docs/howto/rst-directives.html
+ https://docutils.sourceforge.io/docs/howto/rst-directives.html
- :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -64,7 +64,7 @@ class Pygments(Directive):
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
- option_spec = dict([(key, directives.flag) for key in VARIANTS])
+ option_spec = {key: directives.flag for key in VARIANTS}
has_content = True
def run(self):
@@ -76,7 +76,7 @@ def run(self):
lexer = TextLexer()
# take an arbitrary option if more than one is given
formatter = self.options and VARIANTS[list(self.options)[0]] or DEFAULT
- parsed = highlight(u'\n'.join(self.content), lexer, formatter)
+ parsed = highlight('\n'.join(self.content), lexer, formatter)
return [nodes.raw('', parsed, format='html')]
directives.register_directive('sourcecode', Pygments)
diff --git a/pygmentize b/pygmentize
deleted file mode 100755
index aea38727d8..0000000000
--- a/pygmentize
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env python2
-
-import sys
-import pygments.cmdline
-try:
- sys.exit(pygments.cmdline.main(sys.argv))
-except KeyboardInterrupt:
- sys.exit(1)
diff --git a/pygments/__init__.py b/pygments/__init__.py
index 4dd38fee12..86523355d4 100644
--- a/pygments/__init__.py
+++ b/pygments/__init__.py
@@ -17,19 +17,18 @@
* it is usable as a command-line tool and as a library
* ... and it highlights even Brainfuck!
- The `Pygments tip`_ is installable with ``easy_install Pygments==dev``.
+ The `Pygments master branch`_ is installable with ``easy_install Pygments==dev``.
- .. _Pygments tip:
- http://bitbucket.org/birkenfeld/pygments-main/get/tip.zip#egg=Pygments-dev
+ .. _Pygments master branch:
+ https://github.com/pygments/pygments/archive/master.zip#egg=Pygments-dev
- :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
+from io import StringIO, BytesIO
-from pygments.util import StringIO, BytesIO
-
-__version__ = '2.3.1'
+__version__ = '2.7.4'
__docformat__ = 'restructuredtext'
__all__ = ['lex', 'format', 'highlight']
@@ -84,7 +83,3 @@ def highlight(code, lexer, formatter, outfile=None):
"""
return format(lex(code, lexer), formatter, outfile)
-
-if __name__ == '__main__': # pragma: no cover
- from pygments.cmdline import main
- sys.exit(main(sys.argv))
diff --git a/pygments/__main__.py b/pygments/__main__.py
new file mode 100644
index 0000000000..3368bdf39e
--- /dev/null
+++ b/pygments/__main__.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.__main__
+ ~~~~~~~~~~~~~~~~~
+
+ Main entry point for ``python -m pygments``.
+
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+import sys
+import pygments.cmdline
+
+try:
+ sys.exit(pygments.cmdline.main(sys.argv))
+except KeyboardInterrupt:
+ sys.exit(1)
diff --git a/pygments/cmdline.py b/pygments/cmdline.py
index 2f6c14010c..6a8a307ad7 100644
--- a/pygments/cmdline.py
+++ b/pygments/cmdline.py
@@ -5,12 +5,10 @@
Command line interface.
- :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
-from __future__ import print_function
-
import os
import sys
import getopt
@@ -18,7 +16,8 @@
from pygments import __version__, highlight
from pygments.util import ClassNotFound, OptionError, docstring_headline, \
- guess_decode, guess_decode_from_terminal, terminal_encoding
+ guess_decode, guess_decode_from_terminal, terminal_encoding, \
+ UnclosingTextIOWrapper
from pygments.lexers import get_all_lexers, get_lexer_by_name, guess_lexer, \
load_lexer_from_file, get_lexer_for_filename, find_lexer_class_for_filename
from pygments.lexers.special import TextLexer
@@ -233,7 +232,7 @@ def main_inner(popts, args, usage):
return 0
if opts.pop('-V', None) is not None:
- print('Pygments version %s, (c) 2006-2017 by Georg Brandl.' % __version__)
+ print('Pygments version %s, (c) 2006-2021 by Georg Brandl.' % __version__)
return 0
# handle ``pygmentize -L``
@@ -338,8 +337,17 @@ def main_inner(popts, args, usage):
# custom lexer, located relative to user's cwd
if allow_custom_lexer_formatter and '.py' in lexername:
try:
+ filename = None
+ name = None
if ':' in lexername:
filename, name = lexername.rsplit(':', 1)
+
+ if '.py' in name:
+ # This can happen on Windows: If the lexername is
+ # C:\lexer.py -- return to normal load path in that case
+ name = None
+
+ if filename and name:
lexer = load_lexer_from_file(filename, name,
**parsed_opts)
else:
@@ -397,11 +405,7 @@ def main_inner(popts, args, usage):
elif '-s' not in opts: # treat stdin as full file (-s support is later)
# read code from terminal, always in binary mode since we want to
# decode ourselves and be tolerant with it
- if sys.version_info > (3,):
- # Python 3: we have to use .buffer to get a binary stream
- code = sys.stdin.buffer.read()
- else:
- code = sys.stdin.read()
+ code = sys.stdin.buffer.read() # use .buffer to get a binary stream
if not inencoding:
code, inencoding = guess_decode_from_terminal(code, sys.stdin)
# else the lexer will do the decoding
@@ -432,10 +436,18 @@ def main_inner(popts, args, usage):
# custom formatter, located relative to user's cwd
if allow_custom_lexer_formatter and '.py' in fmter:
try:
+ filename = None
+ name = None
if ':' in fmter:
- file, fmtername = fmter.rsplit(':', 1)
- fmter = load_formatter_from_file(file, fmtername,
- **parsed_opts)
+ # Same logic as above for custom lexer
+ filename, name = fmter.rsplit(':', 1)
+
+ if '.py' in name:
+ name = None
+
+ if filename and name:
+ fmter = load_formatter_from_file(filename, name,
+ **parsed_opts)
else:
fmter = load_formatter_from_file(fmter, **parsed_opts)
except ClassNotFound as err:
@@ -466,11 +478,7 @@ def main_inner(popts, args, usage):
fmter = Terminal256Formatter(**parsed_opts)
else:
fmter = TerminalFormatter(**parsed_opts)
- if sys.version_info > (3,):
- # Python 3: we have to use .buffer to get a binary stream
- outfile = sys.stdout.buffer
- else:
- outfile = sys.stdout
+ outfile = sys.stdout.buffer
# determine output encoding if not explicitly selected
if not outencoding:
@@ -485,10 +493,8 @@ def main_inner(popts, args, usage):
if not outfn and sys.platform in ('win32', 'cygwin') and \
fmter.name in ('Terminal', 'Terminal256'): # pragma: no cover
# unfortunately colorama doesn't support binary streams on Py3
- if sys.version_info > (3,):
- from pygments.util import UnclosingTextIOWrapper
- outfile = UnclosingTextIOWrapper(outfile, encoding=fmter.encoding)
- fmter.encoding = None
+ outfile = UnclosingTextIOWrapper(outfile, encoding=fmter.encoding)
+ fmter.encoding = None
try:
import colorama.initialise
except ImportError:
@@ -509,17 +515,17 @@ def main_inner(popts, args, usage):
# ... and do it!
if '-s' not in opts:
# process whole input as per normal...
- highlight(code, lexer, fmter, outfile)
+ try:
+ highlight(code, lexer, fmter, outfile)
+ finally:
+ if outfn:
+ outfile.close()
return 0
else:
# line by line processing of stdin (eg: for 'tail -f')...
try:
while 1:
- if sys.version_info > (3,):
- # Python 3: we have to use .buffer to get a binary stream
- line = sys.stdin.buffer.readline()
- else:
- line = sys.stdin.readline()
+ line = sys.stdin.buffer.readline()
if not line:
break
if not inencoding:
@@ -530,6 +536,9 @@ def main_inner(popts, args, usage):
return 0
except KeyboardInterrupt: # pragma: no cover
return 0
+ finally:
+ if outfn:
+ outfile.close()
def main(args=sys.argv):
@@ -554,7 +563,7 @@ def main(args=sys.argv):
file=sys.stderr)
print('Please report the whole traceback to the issue tracker at',
file=sys.stderr)
- print('.',
+ print('.',
file=sys.stderr)
print('*' * 65, file=sys.stderr)
print(file=sys.stderr)
diff --git a/pygments/console.py b/pygments/console.py
index 31b6839d1c..6e1d13e7e3 100644
--- a/pygments/console.py
+++ b/pygments/console.py
@@ -5,7 +5,7 @@
Format colored console output.
- :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -22,22 +22,19 @@
codes["blink"] = esc + "05m"
codes["overline"] = esc + "06m"
-dark_colors = ["black", "darkred", "darkgreen", "brown", "darkblue",
- "purple", "teal", "lightgray"]
-light_colors = ["darkgray", "red", "green", "yellow", "blue",
- "fuchsia", "turquoise", "white"]
+dark_colors = ["black", "red", "green", "yellow", "blue",
+ "magenta", "cyan", "gray"]
+light_colors = ["brightblack", "brightred", "brightgreen", "brightyellow", "brightblue",
+ "brightmagenta", "brightcyan", "white"]
x = 30
for d, l in zip(dark_colors, light_colors):
codes[d] = esc + "%im" % x
- codes[l] = esc + "%i;01m" % x
+ codes[l] = esc + "%im" % (60 + x)
x += 1
del d, l, x
-codes["darkteal"] = codes["turquoise"]
-codes["darkyellow"] = codes["brown"]
-codes["fuscia"] = codes["fuchsia"]
codes["white"] = codes["bold"]
diff --git a/pygments/filter.py b/pygments/filter.py
index 68be7ad729..36dbc7c836 100644
--- a/pygments/filter.py
+++ b/pygments/filter.py
@@ -5,7 +5,7 @@
Module that implements the default filter.
- :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -17,8 +17,7 @@ def apply_filters(stream, filters, lexer=None):
filter, otherwise the filter receives `None`.
"""
def _apply(filter_, stream):
- for token in filter_.filter(lexer, stream):
- yield token
+ yield from filter_.filter(lexer, stream)
for filter_ in filters:
stream = _apply(filter_, stream)
return stream
@@ -40,7 +39,7 @@ def lowercase(self, lexer, stream, options):
})
-class Filter(object):
+class Filter:
"""
Default filter. Subclass this class or use the `simplefilter`
decorator to create own filters.
@@ -70,5 +69,4 @@ def __init__(self, **options):
def filter(self, lexer, stream):
# pylint: disable=not-callable
- for ttype, value in self.function(lexer, stream, self.options):
- yield ttype, value
+ yield from self.function(lexer, stream, self.options)
diff --git a/pygments/filters/__init__.py b/pygments/filters/__init__.py
index 45f9608c0a..c1d0c8882f 100644
--- a/pygments/filters/__init__.py
+++ b/pygments/filters/__init__.py
@@ -6,7 +6,7 @@
Module containing filter lookup functions and default
filters.
- :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -16,7 +16,7 @@
string_to_tokentype
from pygments.filter import Filter
from pygments.util import get_list_opt, get_int_opt, get_bool_opt, \
- get_choice_opt, ClassNotFound, OptionError, text_type, string_types
+ get_choice_opt, ClassNotFound, OptionError
from pygments.plugin import find_plugin_filters
@@ -45,8 +45,7 @@ def get_filter_by_name(filtername, **options):
def get_all_filters():
"""Return a generator of all filter names."""
- for name in FILTERS:
- yield name
+ yield from FILTERS
for name, _ in find_plugin_filters():
yield name
@@ -88,9 +87,597 @@ def filter(self, lexer, stream):
if ttype in String.Doc or \
ttype in Comment and \
ttype not in Comment.Preproc:
- for sttype, svalue in _replace_special(ttype, value, regex,
- Comment.Special):
- yield sttype, svalue
+ yield from _replace_special(ttype, value, regex, Comment.Special)
+ else:
+ yield ttype, value
+
+
+class SymbolFilter(Filter):
+ """Convert mathematical symbols such as \\ in Isabelle
+ or \\longrightarrow in LaTeX into Unicode characters.
+
+ This is mostly useful for HTML or console output when you want to
+ approximate the source rendering you'd see in an IDE.
+
+ Options accepted:
+
+ `lang` : string
+ The symbol language. Must be one of ``'isabelle'`` or
+ ``'latex'``. The default is ``'isabelle'``.
+ """
+
+ latex_symbols = {
+ '\\alpha' : '\U000003b1',
+ '\\beta' : '\U000003b2',
+ '\\gamma' : '\U000003b3',
+ '\\delta' : '\U000003b4',
+ '\\varepsilon' : '\U000003b5',
+ '\\zeta' : '\U000003b6',
+ '\\eta' : '\U000003b7',
+ '\\vartheta' : '\U000003b8',
+ '\\iota' : '\U000003b9',
+ '\\kappa' : '\U000003ba',
+ '\\lambda' : '\U000003bb',
+ '\\mu' : '\U000003bc',
+ '\\nu' : '\U000003bd',
+ '\\xi' : '\U000003be',
+ '\\pi' : '\U000003c0',
+ '\\varrho' : '\U000003c1',
+ '\\sigma' : '\U000003c3',
+ '\\tau' : '\U000003c4',
+ '\\upsilon' : '\U000003c5',
+ '\\varphi' : '\U000003c6',
+ '\\chi' : '\U000003c7',
+ '\\psi' : '\U000003c8',
+ '\\omega' : '\U000003c9',
+ '\\Gamma' : '\U00000393',
+ '\\Delta' : '\U00000394',
+ '\\Theta' : '\U00000398',
+ '\\Lambda' : '\U0000039b',
+ '\\Xi' : '\U0000039e',
+ '\\Pi' : '\U000003a0',
+ '\\Sigma' : '\U000003a3',
+ '\\Upsilon' : '\U000003a5',
+ '\\Phi' : '\U000003a6',
+ '\\Psi' : '\U000003a8',
+ '\\Omega' : '\U000003a9',
+ '\\leftarrow' : '\U00002190',
+ '\\longleftarrow' : '\U000027f5',
+ '\\rightarrow' : '\U00002192',
+ '\\longrightarrow' : '\U000027f6',
+ '\\Leftarrow' : '\U000021d0',
+ '\\Longleftarrow' : '\U000027f8',
+ '\\Rightarrow' : '\U000021d2',
+ '\\Longrightarrow' : '\U000027f9',
+ '\\leftrightarrow' : '\U00002194',
+ '\\longleftrightarrow' : '\U000027f7',
+ '\\Leftrightarrow' : '\U000021d4',
+ '\\Longleftrightarrow' : '\U000027fa',
+ '\\mapsto' : '\U000021a6',
+ '\\longmapsto' : '\U000027fc',
+ '\\relbar' : '\U00002500',
+ '\\Relbar' : '\U00002550',
+ '\\hookleftarrow' : '\U000021a9',
+ '\\hookrightarrow' : '\U000021aa',
+ '\\leftharpoondown' : '\U000021bd',
+ '\\rightharpoondown' : '\U000021c1',
+ '\\leftharpoonup' : '\U000021bc',
+ '\\rightharpoonup' : '\U000021c0',
+ '\\rightleftharpoons' : '\U000021cc',
+ '\\leadsto' : '\U0000219d',
+ '\\downharpoonleft' : '\U000021c3',
+ '\\downharpoonright' : '\U000021c2',
+ '\\upharpoonleft' : '\U000021bf',
+ '\\upharpoonright' : '\U000021be',
+ '\\restriction' : '\U000021be',
+ '\\uparrow' : '\U00002191',
+ '\\Uparrow' : '\U000021d1',
+ '\\downarrow' : '\U00002193',
+ '\\Downarrow' : '\U000021d3',
+ '\\updownarrow' : '\U00002195',
+ '\\Updownarrow' : '\U000021d5',
+ '\\langle' : '\U000027e8',
+ '\\rangle' : '\U000027e9',
+ '\\lceil' : '\U00002308',
+ '\\rceil' : '\U00002309',
+ '\\lfloor' : '\U0000230a',
+ '\\rfloor' : '\U0000230b',
+ '\\flqq' : '\U000000ab',
+ '\\frqq' : '\U000000bb',
+ '\\bot' : '\U000022a5',
+ '\\top' : '\U000022a4',
+ '\\wedge' : '\U00002227',
+ '\\bigwedge' : '\U000022c0',
+ '\\vee' : '\U00002228',
+ '\\bigvee' : '\U000022c1',
+ '\\forall' : '\U00002200',
+ '\\exists' : '\U00002203',
+ '\\nexists' : '\U00002204',
+ '\\neg' : '\U000000ac',
+ '\\Box' : '\U000025a1',
+ '\\Diamond' : '\U000025c7',
+ '\\vdash' : '\U000022a2',
+ '\\models' : '\U000022a8',
+ '\\dashv' : '\U000022a3',
+ '\\surd' : '\U0000221a',
+ '\\le' : '\U00002264',
+ '\\ge' : '\U00002265',
+ '\\ll' : '\U0000226a',
+ '\\gg' : '\U0000226b',
+ '\\lesssim' : '\U00002272',
+ '\\gtrsim' : '\U00002273',
+ '\\lessapprox' : '\U00002a85',
+ '\\gtrapprox' : '\U00002a86',
+ '\\in' : '\U00002208',
+ '\\notin' : '\U00002209',
+ '\\subset' : '\U00002282',
+ '\\supset' : '\U00002283',
+ '\\subseteq' : '\U00002286',
+ '\\supseteq' : '\U00002287',
+ '\\sqsubset' : '\U0000228f',
+ '\\sqsupset' : '\U00002290',
+ '\\sqsubseteq' : '\U00002291',
+ '\\sqsupseteq' : '\U00002292',
+ '\\cap' : '\U00002229',
+ '\\bigcap' : '\U000022c2',
+ '\\cup' : '\U0000222a',
+ '\\bigcup' : '\U000022c3',
+ '\\sqcup' : '\U00002294',
+ '\\bigsqcup' : '\U00002a06',
+ '\\sqcap' : '\U00002293',
+ '\\Bigsqcap' : '\U00002a05',
+ '\\setminus' : '\U00002216',
+ '\\propto' : '\U0000221d',
+ '\\uplus' : '\U0000228e',
+ '\\bigplus' : '\U00002a04',
+ '\\sim' : '\U0000223c',
+ '\\doteq' : '\U00002250',
+ '\\simeq' : '\U00002243',
+ '\\approx' : '\U00002248',
+ '\\asymp' : '\U0000224d',
+ '\\cong' : '\U00002245',
+ '\\equiv' : '\U00002261',
+ '\\Join' : '\U000022c8',
+ '\\bowtie' : '\U00002a1d',
+ '\\prec' : '\U0000227a',
+ '\\succ' : '\U0000227b',
+ '\\preceq' : '\U0000227c',
+ '\\succeq' : '\U0000227d',
+ '\\parallel' : '\U00002225',
+ '\\mid' : '\U000000a6',
+ '\\pm' : '\U000000b1',
+ '\\mp' : '\U00002213',
+ '\\times' : '\U000000d7',
+ '\\div' : '\U000000f7',
+ '\\cdot' : '\U000022c5',
+ '\\star' : '\U000022c6',
+ '\\circ' : '\U00002218',
+ '\\dagger' : '\U00002020',
+ '\\ddagger' : '\U00002021',
+ '\\lhd' : '\U000022b2',
+ '\\rhd' : '\U000022b3',
+ '\\unlhd' : '\U000022b4',
+ '\\unrhd' : '\U000022b5',
+ '\\triangleleft' : '\U000025c3',
+ '\\triangleright' : '\U000025b9',
+ '\\triangle' : '\U000025b3',
+ '\\triangleq' : '\U0000225c',
+ '\\oplus' : '\U00002295',
+ '\\bigoplus' : '\U00002a01',
+ '\\otimes' : '\U00002297',
+ '\\bigotimes' : '\U00002a02',
+ '\\odot' : '\U00002299',
+ '\\bigodot' : '\U00002a00',
+ '\\ominus' : '\U00002296',
+ '\\oslash' : '\U00002298',
+ '\\dots' : '\U00002026',
+ '\\cdots' : '\U000022ef',
+ '\\sum' : '\U00002211',
+ '\\prod' : '\U0000220f',
+ '\\coprod' : '\U00002210',
+ '\\infty' : '\U0000221e',
+ '\\int' : '\U0000222b',
+ '\\oint' : '\U0000222e',
+ '\\clubsuit' : '\U00002663',
+ '\\diamondsuit' : '\U00002662',
+ '\\heartsuit' : '\U00002661',
+ '\\spadesuit' : '\U00002660',
+ '\\aleph' : '\U00002135',
+ '\\emptyset' : '\U00002205',
+ '\\nabla' : '\U00002207',
+ '\\partial' : '\U00002202',
+ '\\flat' : '\U0000266d',
+ '\\natural' : '\U0000266e',
+ '\\sharp' : '\U0000266f',
+ '\\angle' : '\U00002220',
+ '\\copyright' : '\U000000a9',
+ '\\textregistered' : '\U000000ae',
+ '\\textonequarter' : '\U000000bc',
+ '\\textonehalf' : '\U000000bd',
+ '\\textthreequarters' : '\U000000be',
+ '\\textordfeminine' : '\U000000aa',
+ '\\textordmasculine' : '\U000000ba',
+ '\\euro' : '\U000020ac',
+ '\\pounds' : '\U000000a3',
+ '\\yen' : '\U000000a5',
+ '\\textcent' : '\U000000a2',
+ '\\textcurrency' : '\U000000a4',
+ '\\textdegree' : '\U000000b0',
+ }
+
+ isabelle_symbols = {
+ '\\' : '\U0001d7ec',
+ '\\' : '\U0001d7ed',
+ '\\' : '\U0001d7ee',
+ '\\' : '\U0001d7ef',
+ '\\' : '\U0001d7f0',
+ '\\' : '\U0001d7f1',
+ '\\' : '\U0001d7f2',
+ '\\' : '\U0001d7f3',
+ '\\' : '\U0001d7f4',
+ '\\' : '\U0001d7f5',
+ '\\' : '\U0001d49c',
+ '\\' : '\U0000212c',
+ '\\' : '\U0001d49e',
+ '\\' : '\U0001d49f',
+ '\\' : '\U00002130',
+ '\\' : '\U00002131',
+ '\\' : '\U0001d4a2',
+ '\\' : '\U0000210b',
+ '\\' : '\U00002110',
+ '\\' : '\U0001d4a5',
+ '\\' : '\U0001d4a6',
+ '\\' : '\U00002112',
+ '\\' : '\U00002133',
+ '\\' : '\U0001d4a9',
+ '\\' : '\U0001d4aa',
+ '\\' : '\U0001d4ab',
+ '\\' : '\U0001d4ac',
+ '\\' : '\U0000211b',
+ '\\' : '\U0001d4ae',
+ '\\' : '\U0001d4af',
+ '\\' : '\U0001d4b0',
+ '\\' : '\U0001d4b1',
+ '\\' : '\U0001d4b2',
+ '\\' : '\U0001d4b3',
+ '\\' : '\U0001d4b4',
+ '\\' : '\U0001d4b5',
+ '\\' : '\U0001d5ba',
+ '\\' : '\U0001d5bb',
+ '\\' : '\U0001d5bc',
+ '\\' : '\U0001d5bd',
+ '\\' : '\U0001d5be',
+ '\\' : '\U0001d5bf',
+ '\\' : '\U0001d5c0',
+ '\\' : '\U0001d5c1',
+ '\\' : '\U0001d5c2',
+ '\\' : '\U0001d5c3',
+ '\\' : '\U0001d5c4',
+ '\\' : '\U0001d5c5',
+ '\\' : '\U0001d5c6',
+ '\\' : '\U0001d5c7',
+ '\\' : '\U0001d5c8',
+ '\\' : '\U0001d5c9',
+ '\\' : '\U0001d5ca',
+ '\\' : '\U0001d5cb',
+ '\\' : '\U0001d5cc',
+ '\\' : '\U0001d5cd',
+ '\\' : '\U0001d5ce',
+ '\\' : '\U0001d5cf',
+ '\\' : '\U0001d5d0',
+ '\\' : '\U0001d5d1',
+ '\\' : '\U0001d5d2',
+ '\\' : '\U0001d5d3',
+ '\\' : '\U0001d504',
+ '\\' : '\U0001d505',
+ '\\' : '\U0000212d',
+ '\\' : '\U0001d507',
+ '\\' : '\U0001d508',
+ '\\' : '\U0001d509',
+ '\\' : '\U0001d50a',
+ '\\' : '\U0000210c',
+ '\\' : '\U00002111',
+ '\\' : '\U0001d50d',
+ '\\' : '\U0001d50e',
+ '\\' : '\U0001d50f',
+ '\\' : '\U0001d510',
+ '\\' : '\U0001d511',
+ '\\' : '\U0001d512',
+ '\\' : '\U0001d513',
+ '\\' : '\U0001d514',
+ '\\' : '\U0000211c',
+ '\\' : '\U0001d516',
+ '\\' : '\U0001d517',
+ '\\' : '\U0001d518',
+ '\\' : '\U0001d519',
+ '\\' : '\U0001d51a',
+ '\\' : '\U0001d51b',
+ '\\' : '\U0001d51c',
+ '\\' : '\U00002128',
+ '\\' : '\U0001d51e',
+ '\\' : '\U0001d51f',
+ '\\' : '\U0001d520',
+ '\\' : '\U0001d521',
+ '\\' : '\U0001d522',
+ '\\' : '\U0001d523',
+ '\\