mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 10:47:35 -05:00
add markdown suppport
This commit is contained in:
14
pyscript.core/src/stdlib/pyweb/ui/markdown.py
Normal file
14
pyscript.core/src/stdlib/pyweb/ui/markdown.py
Normal 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)
|
||||
|
||||
Reference in New Issue
Block a user