diff options
author | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
---|---|---|
committer | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
commit | 1dd3124a9770e11b6684e5dd1e6bc15a0aa3bc67 (patch) | |
tree | 87a171383266dd1f64196589af081bc2f8e497c3 /doc/docs/filters.rst | |
parent | f1c080e184dc1bbc36eaa7cd729ff3a499de568a (diff) | |
download | pygments-master.tar.gz |
Diffstat (limited to 'doc/docs/filters.rst')
-rw-r--r-- | doc/docs/filters.rst | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/doc/docs/filters.rst b/doc/docs/filters.rst deleted file mode 100644 index ff2519a3..00000000 --- a/doc/docs/filters.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. -*- mode: rst -*- - -======= -Filters -======= - -.. versionadded:: 0.7 - -You can filter token streams coming from lexers to improve or annotate the -output. For example, you can highlight special words in comments, convert -keywords to upper or lowercase to enforce a style guide etc. - -To apply a filter, you can use the `add_filter()` method of a lexer: - -.. sourcecode:: pycon - - >>> from pygments.lexers import PythonLexer - >>> l = PythonLexer() - >>> # add a filter given by a string and options - >>> l.add_filter('codetagify', case='lower') - >>> l.filters - [<pygments.filters.CodeTagFilter object at 0xb785decc>] - >>> from pygments.filters import KeywordCaseFilter - >>> # or give an instance - >>> l.add_filter(KeywordCaseFilter(case='lower')) - -The `add_filter()` method takes keyword arguments which are forwarded to -the constructor of the filter. - -To get a list of all registered filters by name, you can use the -`get_all_filters()` function from the `pygments.filters` module that returns an -iterable for all known filters. - -If you want to write your own filter, have a look at :doc:`Write your own filter -<filterdevelopment>`. - - -Builtin Filters -=============== - -.. pygmentsdoc:: filters |