5.1.1.3.3. SyntaxHighlighter¶
This modules provides a facility to syntax highlight a text document.
-
class
CodeReview.Diff.SyntaxHighlighter.HighlightedText(raw_text_document, lexer)[source]¶ Bases:
listThis class implements an highlighted text.
The parameter raw_text_document is a
DiffViewer.RawTextDocumentinstance and the parameter lexer is a Pygments lexer instance.
-
class
CodeReview.Diff.SyntaxHighlighter.HighlightedTextFragment(flat_slice, token)[source]¶ Bases:
objectThis class implements an highlighted text fragment.
The parameter token specifies the Pygments token type.
Public Attributes:
slicetoken
-
CodeReview.Diff.SyntaxHighlighter.highlight_text(raw_text_document, lexer)[source]¶ Highlight a text.
The parameter raw_text_document is a
DiffViewer.RawTextDocumentinstance and the parameter lexer is a Pygments lexer instance.Return an
DiffViewer.TextDocumentModelinstance. The document has one text block that contains all the fragments. Text fragments use light views.