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 64 of file materialxgltf/plugin.py.

Constructor & Destructor Documentation

◆ __init__()

plugin.GLTFHighlighter.__init__ ( self)

Initialize the highlighter.

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

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

Member Function Documentation

◆ highlight()

plugin.GLTFHighlighter.highlight ( self,
text )

Highlight the text.

Parameters
textThe text to highlight
Returns
: The highlighted text

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

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

Member Data Documentation

◆ formatter

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

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

◆ lexer

plugin.GLTFHighlighter.lexer = JsonLexer()

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


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