mirror of
https://github.com/zaaarf/friendenstein.git
synced 2024-11-22 15:34:50 +01:00
feat: made css highlighting optional
This commit is contained in:
parent
9ccf994f55
commit
baab3e11b0
1 changed files with 6 additions and 2 deletions
|
@ -115,7 +115,9 @@
|
||||||
--codeLineColor: {% if config.extra.colors.light.code_line_color %}{{ config.extra.colors.light.code_line_color }}{% else %}#FFFFFF{% endif %};
|
--codeLineColor: {% if config.extra.colors.light.code_line_color %}{{ config.extra.colors.light.code_line_color }}{% else %}#FFFFFF{% endif %};
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
{% if config.markdown.highlight_code and config.markdown.highlight_theme == "css" %}
|
||||||
<link id="syntaxHighlighting" rel="stylesheet" type="text/css" href="{{ get_url(path='ayu-dark.css', trailing_slash=false) | safe }}" />
|
<link id="syntaxHighlighting" rel="stylesheet" type="text/css" href="{{ get_url(path='ayu-dark.css', trailing_slash=false) | safe }}" />
|
||||||
|
{% endif %}
|
||||||
<link rel="stylesheet" href="{{ get_url(path='style.css', trailing_slash=false) | safe }}"/>
|
<link rel="stylesheet" href="{{ get_url(path='style.css', trailing_slash=false) | safe }}"/>
|
||||||
{% endblock css %}
|
{% endblock css %}
|
||||||
<script>
|
<script>
|
||||||
|
@ -123,10 +125,12 @@ const setTheme = (theme) => {
|
||||||
document.documentElement.className = theme;
|
document.documentElement.className = theme;
|
||||||
localStorage.setItem('theme', theme);
|
localStorage.setItem('theme', theme);
|
||||||
var link = document.getElementById('syntaxHighlighting');
|
var link = document.getElementById('syntaxHighlighting');
|
||||||
|
|
||||||
|
var shouldLoadSyntax = {% if config.markdown.highlight_code and config.markdown.highlight_theme == "css" %}true{% else %}false{% endif %};
|
||||||
if (theme === 'light') {
|
if (theme === 'light') {
|
||||||
link.setAttribute('href', '{{ get_url(path="hl-light.css", trailing_slash=false) | safe }}');
|
link.setAttribute('href', {% if config.extra.hightlighting_css_light %}'{{ get_url(path=config.extra.highlighting_css_light) | safe }}'{% else %}'{{ get_url(path="hl-light.css") | safe }}'{% endif %});
|
||||||
} else if (theme === 'dark') {
|
} else if (theme === 'dark') {
|
||||||
link.setAttribute('href', '{{ get_url(path="hl-dark.css", trailing_slash=false) | safe }}');
|
link.setAttribute('href', {% if config.extra.hightlighting_css_dark %}'{{ get_url(path=config.extra.highlighting_css_dark) | safe }}'{% else %}'{{ get_url(path="hl-dark.css") | safe }}'{% endif %});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue