mirror of
https://github.com/ION606/ML-pipeline.git
synced 2026-05-14 21:06:54 +00:00
quality of life upgrades and bug fixes
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
from pygments import highlight
|
||||
from pygments.lexers import get_lexer_by_name
|
||||
from pygments.formatters import TerminalFormatter
|
||||
import debug as debugMod
|
||||
|
||||
|
||||
def highlight_code(code: str, language: str = 'py') -> None:
|
||||
try:
|
||||
lexer = get_lexer_by_name(language)
|
||||
except ValueError:
|
||||
debugMod.log("Warning: Language not recognized. Printing without highlighting.")
|
||||
return code
|
||||
|
||||
formatter = TerminalFormatter()
|
||||
return highlight(code, lexer, formatter)
|
||||
Reference in New Issue
Block a user