diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/filters.rst	Mon May 11 01:31:12 2026 +0200
@@ -0,0 +1,57 @@
+.. -*- coding: utf-8; indent-tabs-mode: nil; -*-
+
+*********
+ Filters
+*********
+
+The package contains the following filters:
+
+.. include:: filterlist.rst
+
+
+The AlgPseudocode lexer yields an error token for the following code block.
+`Sphinx`_ therefore suppresses highlighting completely:
+
+.. code-block:: none
+
+   \EXPR{TEST}
+
+With a custom AlgPseudocode lexer that has ``prohibit_raiseonerror_filter``
+activated the output in `Sphinx`_ is as:
+
+.. code-block:: no-raiseonerror-algpseudocode
+
+   \EXPR{TEST}
+
+
+With the "errortogenericerror" filter the very same block is highlighted
+as:
+
+.. code-block:: genericerror-algpseudocode
+
+   \EXPR{TEST}
+
+
+ErrorToGenericErrorTokenFilter
+==============================
+
+:Name: errortogenericerror
+:Filter Options: none
+
+Replace all :py:class:`pygments.token.Token.Error` tokens in a stream by
+:py:class:`pygments.token.Token.Generic.Error` tokens.
+
+
+TokenReplaceFilter
+==================
+
+:Name: tokenreplace
+:Required Filter Options:
+   **token_from**
+     **Type:** :py:class:`str` or :py:class:`pygments.token.Token`
+
+   **token_to**
+     **Type:** :py:class:`str` or :py:class:`pygments.token.Token`
+
+Replace all token types given in `token_from` by the token type given
+in `token_to`.