♻️ Get rid of build-time dep on markdown
We need to process markdown stuff in OctoPrint now anyhow, might as well just convert the files previously converted during build on the go. That also makes it easier to keep setup.py Py2 compatible.
This commit is contained in:
1 parent
c6e1ed5f73
commit
884f2008f4
7 files changed
+20
-26
No files matched your search
@@ -1555,18 +1555,10 @@ class Server:
|
||||
|
||||
loaders = [app.jinja_loader, app.jinja_env.prefix_loader]
|
||||
if octoprint.util.is_running_from_source():
|
||||
from markdown import markdown
|
||||
|
||||
root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))
|
||||
allowed = ["AUTHORS.md", "SUPPORTERS.md", "THIRDPARTYLICENSES.md"]
|
||||
files = {
|
||||
"_data/" + name + ".html": os.path.join(root, name) for name in allowed
|
||||
}
|
||||
loaders.append(
|
||||
octoprint.util.jinja.SelectedFilesWithConversionLoader(
|
||||
files, conversion=markdown
|
||||
)
|
||||
)
|
||||
files = {"_data/" + name: os.path.join(root, name) for name in allowed}
|
||||
loaders.append(octoprint.util.jinja.SelectedFilesWithConversionLoader(files))
|
||||
|
||||
# TODO: Remove this in 2.0.0
|
||||
warning_message = "Loading plugin template '{template}' from '{filename}' without plugin prefix, this is deprecated and will soon no longer be supported."
|
||||
|
||||
@@ -1 +1 @@
|
||||
{% filter externalize_links %}{% filter offset_html_headers(2) %}{% include "_data/AUTHORS.md.html" ignore missing %}{% endfilter %}{% endfilter %}
|
||||
{% filter externalize_links %}{% filter markdown %}{% filter offset_markdown_headers(2) %}{% include "_data/AUTHORS.md" ignore missing %}{% endfilter %}{% endfilter %}{% endfilter %}
|
||||
@@ -1 +1 @@
|
||||
{% filter externalize_links %}{% filter offset_html_headers(2) %}{% include "_data/SUPPORTERS.md.html" ignore missing %}{% endfilter %}{% endfilter %}
|
||||
{% filter externalize_links %}{% filter markdown %}{% filter offset_markdown_headers(2) %}{% include "_data/SUPPORTERS.md" ignore missing %}{% endfilter %}{% endfilter %}{% endfilter %}
|
||||
@@ -1 +1 @@
|
||||
{% filter externalize_links %}{% filter offset_html_headers(2) %}{% include "_data/THIRDPARTYLICENSES.md.html" ignore missing %}{% endfilter %}{% endfilter %}
|
||||
{% filter externalize_links %}{% filter markdown %}{% filter offset_markdown_headers(2) %}{% include "_data/THIRDPARTYLICENSES.md" ignore missing %}{% endfilter %}{% endfilter %}{% endfilter %}
|
||||
@@ -289,8 +289,8 @@ class MarkdownFilter:
|
||||
app.jinja_env.filters.setdefault("markdown", self)
|
||||
|
||||
def __call__(self, stream):
|
||||
from jinja2 import Markup
|
||||
from markdown import Markdown
|
||||
from markupsafe import Markup
|
||||
|
||||
# Markdown is not thread safe
|
||||
markdown = Markdown(**self._markdown_options)
|
||||
|
||||
Reference in new issue
Block a user