add markdown suppport

This commit is contained in:
Fabio Pliger
2024-01-31 16:51:58 -06:00
parent a5c3fc62c6
commit 8ade988e82
5 changed files with 24 additions and 19 deletions

View File

@@ -0,0 +1,14 @@
"""Markdown module to generate web/HTML components from Markdown code"""
from pyscript import document, window
from pyweb.ui.elements import TextElementBase
class markdown(TextElementBase):
"""Markdown component to render HTML from Markdown code"""
tag = 'div'
def __init__(self, content, style = None, **kwargs):
# TODO: We should sanitize the content!!!!!
html = window.marked.parse(content)
super().__init__(html, style=style, **kwargs)