QuiltiX Plugins 0.0.1
Custom Plugins for QuiltiX
Loading...
Searching...
No Matches
plugin.GLTFHighlighter Class Reference

Highlighter for glTF text. More...

Public Member Functions

 __init__ (self)
 Initialize the highlighter.
 
 highlight (self, text)
 Highlight the text.
 

Public Attributes

 lexer = JsonLexer()
 
 formatter = HtmlFormatter(linenos=False, style='github-dark')
 

Detailed Description

Highlighter for glTF text.

Definition at line 68 of file materialxgltf/plugin.py.

Constructor & Destructor Documentation

◆ __init__()

plugin.GLTFHighlighter.__init__ ( self)

Initialize the highlighter.

Definition at line 72 of file materialxgltf/plugin.py.

72 def __init__(self):
73 '''
74 @brief Initialize the highlighter
75 '''
76 self.lexer = JsonLexer()
77 # We don't add line numbers since this get's copied with
78 # copy-paste.
79 self.formatter = HtmlFormatter(linenos=False, style='github-dark')
80

Member Function Documentation

◆ highlight()

plugin.GLTFHighlighter.highlight ( self,
text )

Highlight the text.

Parameters
textThe text to highlight
Returns
: The highlighted text

Definition at line 81 of file materialxgltf/plugin.py.

81 def highlight(self, text):
82 '''
83 @brief Highlight the text
84 @param text: The text to highlight
85 @return: The highlighted text
86 '''
87 highlighted_html = highlight(text, self.lexer, self.formatter)
88 styles = (
89 f"<style>"
90 f"{self.formatter.get_style_defs('.highlight')}"
91 f"pre {{ line-height: 1.0; margin: 0; }}"
92 f"</style>"
93 )
94 full_html = f"<html><head>{styles}</head><body>{highlighted_html}</body></html>"
95 return full_html
96
97#class MyRequestInterceptor(QWebEngineUrlRequestInterceptor):
98# def interceptRequest(self, info):
99# info.setHttpHeader(b'Permissions-Policy', b'interest-cohort=()')
100

Member Data Documentation

◆ formatter

plugin.GLTFHighlighter.formatter = HtmlFormatter(linenos=False, style='github-dark')

Definition at line 79 of file materialxgltf/plugin.py.

◆ lexer

plugin.GLTFHighlighter.lexer = JsonLexer()

Definition at line 76 of file materialxgltf/plugin.py.


The documentation for this class was generated from the following file: