diff options
Diffstat (limited to 'muppet/syntax_highlight/plain.py')
-rw-r--r-- | muppet/syntax_highlight/plain.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/muppet/syntax_highlight/plain.py b/muppet/syntax_highlight/plain.py new file mode 100644 index 0000000..0d1234f --- /dev/null +++ b/muppet/syntax_highlight/plain.py @@ -0,0 +1,14 @@ +"""Non-highlighter useful as a backup.""" + +import html + +available = True + + +def highlight(code: str, language: str) -> str: + """Return the code "highlighted" by wrapping it in <pre> tags.""" + out = f'<pre><code class="{language}">{html.escape(code)}</code></pre>' + return f""" + <!-- "Genererated" as plain output --> + <div class"highlight-plain">{out}</div> + """ |