Add katex_url from custom CDN
This commit is contained in:
parent
00bd1128d1
commit
eef7f001d5
5 changed files with 26 additions and 6 deletions
5
app.py
5
app.py
|
|
@ -373,7 +373,7 @@ def md(text, expand_magic=False, toc=True, math=True):
|
||||||
extensions.append('markdown_katex')
|
extensions.append('markdown_katex')
|
||||||
extension_configs['markdown_katex'] = {
|
extension_configs['markdown_katex'] = {
|
||||||
'no_inline_svg': True,
|
'no_inline_svg': True,
|
||||||
'insert_fonts_css': True
|
'insert_fonts_css': not _getconf('site', 'katex_url')
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
return markdown.Markdown(extensions=extensions, extension_configs=extension_configs).convert(text)
|
return markdown.Markdown(extensions=extensions, extension_configs=extension_configs).convert(text)
|
||||||
|
|
@ -446,7 +446,8 @@ def _inject_variables():
|
||||||
'strong': lambda x:Markup('<strong>{0}</strong>').format(x),
|
'strong': lambda x:Markup('<strong>{0}</strong>').format(x),
|
||||||
'app_version': __version__,
|
'app_version': __version__,
|
||||||
'math_version': markdown_katex.__version__ if markdown_katex else None,
|
'math_version': markdown_katex.__version__ if markdown_katex else None,
|
||||||
'material_icons_url': _getconf('site', 'material_icons_url')
|
'material_icons_url': _getconf('site', 'material_icons_url'),
|
||||||
|
'katex_url': _getconf('site', 'katex_url')
|
||||||
}
|
}
|
||||||
|
|
||||||
@login_manager.user_loader
|
@login_manager.user_loader
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,9 @@
|
||||||
"username": "Username",
|
"username": "Username",
|
||||||
"password": "Password",
|
"password": "Password",
|
||||||
"no-account-sign-up": "Don’t have an account?",
|
"no-account-sign-up": "Don’t have an account?",
|
||||||
"sign-up": "Sign up"
|
"sign-up": "Sign up",
|
||||||
|
"not-found": "Not found",
|
||||||
|
"not-found-text-1": "The page at",
|
||||||
|
"not-found-text-2": "does not exist."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -34,6 +34,9 @@
|
||||||
"back-to": "Torna a",
|
"back-to": "Torna a",
|
||||||
"login": "Entra",
|
"login": "Entra",
|
||||||
"username": "Nome utente",
|
"username": "Nome utente",
|
||||||
"password": "Password"
|
"password": "Password",
|
||||||
|
"not-found": "Non trovato",
|
||||||
|
"not-found-text-1": "La pagina con url",
|
||||||
|
"not-found-text-2": "non esiste"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,6 +12,19 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if math_version and katex_url %}
|
||||||
|
<link rel="stylesheet" href="{{ katex_url }}" />
|
||||||
|
<style type="text/css">
|
||||||
|
.katex img {
|
||||||
|
object-fit: fill;
|
||||||
|
padding: unset;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: inherit;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endif %}
|
||||||
{% block json_info %}{% endblock %}
|
{% block json_info %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body{% if request.cookies.get('dark') == '1' %} class="dark"{% endif %}>
|
<body{% if request.cookies.get('dark') == '1' %} class="dark"{% endif %}>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
{% block title %}Not found - {{ app_name }}{% endblock %}
|
{% block title %}Not found - {{ app_name }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Not Found</h1>
|
<h1>{{ T('not-found') }}</h1>
|
||||||
|
|
||||||
<p>The url at <strong>{{ request.path }}</strong> does not exist.</p>
|
<p>{{ T('not-found-text-1')}} <strong>{{ request.path }}</strong> {{ T('not-found-text-2' )}}.</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue