Skip to content

Commit

Permalink
Made markdown element use the extensions setup to only load the css w…
Browse files Browse the repository at this point in the history
…hen the element is used
  • Loading branch information
Declow committed Oct 3, 2024
1 parent c700e43 commit 628b3c1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from pathlib import Path
import markdown2

from uiwiz.elements.html import Html

MARKDOWN = Path(__file__).parent / "markdown.css"
CODE_HIGHLIGHT = Path(__file__).parent / "codehighlight.css"

class Markdown(Html):

class Markdown(Html, extensions=[MARKDOWN, CODE_HIGHLIGHT]):
def __init__(self, content="") -> None:
super().__init__(content=content)
self.render_html = False
Expand Down
2 changes: 0 additions & 2 deletions uiwiz/templates/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<meta charset="utf-8">
<title>{{title}}</title>

<link href="/static/codehighlight.css" rel="stylesheet" type="text/css" />
<link href="/static/markdown.css" rel="stylesheet" type="text/css" />
<link href="/static/app.css" rel="stylesheet" type="text/css" />
</head>

Expand Down
2 changes: 1 addition & 1 deletion uiwiz/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from uiwiz.elements.input import Input as input
from uiwiz.elements.label import Label as label
from uiwiz.elements.link import Link as link
from uiwiz.elements.markdown import Markdown as markdown
from uiwiz.elements.markdown.markdown import Markdown as markdown
from uiwiz.elements.nav import Nav as nav
from uiwiz.elements.radio import Radio as radio
from uiwiz.elements.range import Range as range
Expand Down

0 comments on commit 628b3c1

Please sign in to comment.