comparison docs/filters.rst @ 168:bff8b900713a

REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 11 May 2026 01:31:12 +0200
parents
children ad80fcbf7b47
comparison
equal deleted inserted replaced
167:ddefcc20367c 168:bff8b900713a
1 .. -*- coding: utf-8; indent-tabs-mode: nil; -*-
2
3 *********
4 Filters
5 *********
6
7 The package contains the following filters:
8
9 .. include:: filterlist.rst
10
11
12 The AlgPseudocode lexer yields an error token for the following code block.
13 `Sphinx`_ therefore suppresses highlighting completely:
14
15 .. code-block:: none
16
17 \EXPR{TEST}
18
19 With a custom AlgPseudocode lexer that has ``prohibit_raiseonerror_filter``
20 activated the output in `Sphinx`_ is as:
21
22 .. code-block:: no-raiseonerror-algpseudocode
23
24 \EXPR{TEST}
25
26
27 With the "errortogenericerror" filter the very same block is highlighted
28 as:
29
30 .. code-block:: genericerror-algpseudocode
31
32 \EXPR{TEST}
33
34
35 ErrorToGenericErrorTokenFilter
36 ==============================
37
38 :Name: errortogenericerror
39 :Filter Options: none
40
41 Replace all :py:class:`pygments.token.Token.Error` tokens in a stream by
42 :py:class:`pygments.token.Token.Generic.Error` tokens.
43
44
45 TokenReplaceFilter
46 ==================
47
48 :Name: tokenreplace
49 :Required Filter Options:
50 **token_from**
51 **Type:** :py:class:`str` or :py:class:`pygments.token.Token`
52
53 **token_to**
54 **Type:** :py:class:`str` or :py:class:`pygments.token.Token`
55
56 Replace all token types given in `token_from` by the token type given
57 in `token_to`.