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

Public Member Functions

 __init__ (self, font_size="14px")
 
 highlight (self, text)
 

Public Attributes

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

Detailed Description

Definition at line 67 of file materialxgltf_pt/plugin.py.

Constructor & Destructor Documentation

◆ __init__()

plugin.JsonHighlighter.__init__ ( self,
font_size = "14px" )

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

68 def __init__(self, font_size="14px"):
69 self.lexer = JsonLexer()
70 self.formatter = HtmlFormatter(linenos=False, style='github-dark')
71 self.font_size = font_size
72

Member Function Documentation

◆ highlight()

plugin.JsonHighlighter.highlight ( self,
text )

Definition at line 73 of file materialxgltf_pt/plugin.py.

73 def highlight(self, text):
74 highlighted_html = highlight(text, self.lexer, self.formatter)
75 styles = (
76 f"<style>"
77 f"{self.formatter.get_style_defs('.highlight')}"
78 f"pre {{ line-height: 1.0; margin: 0; font-size: {self.font_size}; }}"
79 f"</style>"
80 )
81 full_html = f"<html><head>{styles}</head><body>{highlighted_html}</body></html>"
82 return full_html
83

Member Data Documentation

◆ font_size

plugin.JsonHighlighter.font_size = font_size

Definition at line 71 of file materialxgltf_pt/plugin.py.

◆ formatter

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

Definition at line 70 of file materialxgltf_pt/plugin.py.

◆ lexer

plugin.JsonHighlighter.lexer = JsonLexer()

Definition at line 69 of file materialxgltf_pt/plugin.py.


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