Compare commits

...

6 commits

Author SHA1 Message Date
Jan Christian Grünhage 3c56f7a723 feat: add katex support 2021-08-13 11:51:20 +02:00
Jan Christian Gr??nhage 5f31463079 generate summary if it isn't present 2021-08-13 11:51:20 +02:00
Jan Christian Gr??nhage 71a75c7795 render content on landing page 2021-08-13 11:51:20 +02:00
Vincent Prouillet 33def459cc Update for newer Zola 2021-02-18 22:18:03 +01:00
Vincent Prouillet 9f1cc6cace
Merge pull request #23 from Bobo1239/master
Remove empty space at the bottom of code blocks
2020-10-01 17:01:53 +02:00
Boris-Chengbiao Zhou bb6b6e0022 Remove empty space at the bottom of code blocks 2020-10-01 02:06:18 +02:00
6 changed files with 62 additions and 7 deletions

View file

@ -13,8 +13,8 @@
First download this theme to your `themes` directory:
```bash
$ cd themes
$ git clone https://github.com/getzola/after-dark.git
cd themes
git clone https://github.com/getzola/after-dark.git
```
and then enable it in your `config.toml`:
@ -35,8 +35,8 @@ The theme requires tags and categories taxonomies to be enabled in your `config.
```toml
taxonomies = [
# You can enable/disable RSS
{name = "categories", rss = true},
{name = "tags", rss = true},
{name = "categories", feed = true},
{name = "tags", feed = true},
]
```
If you want to paginate taxonomies pages, you will need to overwrite the templates
@ -65,5 +65,33 @@ The site title is shown on the homepage. As it might be different from the `<tit
element that the `title` field in the config represents, you can set the `after_dark_title`
instead.
### KaTeX math formula support
This theme contains math formula support using [KaTeX](https://katex.org/),
which can be enabled by setting `katex_enable = true` in the `extra` section
of `config.toml`:
```toml
[extra]
katex_enable = true
```
After enabling this extension, the `katex` short code can be used in documents:
* `{{ katex(body="\KaTeX") }}` to typeset a math formula inlined into a text,
similar to `$...$` in LaTeX
* `{% katex(block=true) %}\KaTeX{% end %}` to typeset a block of math formulas,
similar to `$$...$$` in LaTeX
#### Automatic rendering without short codes
Optionally, `\\( \KaTeX \\)` inline and `\\[ \KaTeX \\]` / `$$ \KaTeX $$`
block-style automatic rendering is also supported, if enabled in the config:
```toml
[extra]
katex_enable = true
katex_auto_render = true
```
## Original
This template is based on the Hugo template https://git.habd.as/comfusion/after-dark

View file

@ -5,8 +5,8 @@ description = ""
generate_feed = true
taxonomies = [
{name = "categories", rss = true},
{name = "tags", rss = true},
{name = "categories", feed = true},
{name = "tags", feed = true},
]
[extra]

View file

@ -298,7 +298,7 @@ a:hover {
}
.hack pre code:after, .hack pre code:before {
content: ''
content: none
}
.hack code {

View file

@ -17,8 +17,23 @@
{% block css %}
<link rel="stylesheet" href="{{ get_url(path="site.css", trailing_slash=false) | safe }}">
{% if config.extra.katex_enable %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.css" integrity="sha384-9eLZqc9ds8eNjO3TmqPeYcDj8n+Qfa4nuSiGYa6DjLNcv9BtN69ZIulL9+8CqC9Y" crossorigin="anonymous">
{% endif %}
{% endblock css %}
{% block js %}
{% if config.extra.katex_enable %}
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.js" integrity="sha384-K3vbOmF2BtaVai+Qk37uypf7VrgBubhQreNQe9aGsz9lB63dIFiQVlJbr92dw2Lx" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/contrib/mathtex-script-type.min.js" integrity="sha384-zWYbd0NBwgTsgIdFKVprSfTh1mbMPe5Hz1X3yY4Sd1h/K1cQoUe36OGwAGz/PcDy" crossorigin="anonymous"></script>
{% if config.extra.katex_auto_render %}
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/contrib/auto-render.min.js" integrity="sha384-kmZOZB5ObwgQnS/DuDg6TScgOiWWBiVt0plIRkZCmE6rDZGrEOQeHM5PcHi+nyqe" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
{% endif %}
{% endif %}
{% endblock js %}
{% block extra_head %}
{% endblock extra_head %}
</head>
@ -47,6 +62,11 @@
<h1>{{ config.extra.after_dark_title }}</h1>
</header>
{% endif %}
{% if section.content %}
<div>
{{ section.content | safe }}
</div>
{% endif %}
{% for page in paginator.pages %}
{{ post_macros::page_in_list(page=page) }}
{% endfor %}

View file

@ -28,6 +28,12 @@
{{ page.summary | safe }}
<nav class="readmore"><a itemprop="url" href="{{ page.permalink | safe }}">Read More&nbsp;&raquo;</a></nav>
</div>
{% else %}
<div itemprop="summary">
{{ page.content | striptags | truncate | safe }}
<nav class="readmore"><a itemprop="url" href="{{ page.permalink | safe }}">Read More&nbsp;&raquo;</a></nav>
</div>
{% endif %}
</article>
{% endmacro page_in_list %}

View file

@ -0,0 +1 @@
<script type="math/tex{% if block %};mode=display{% endif %}">{{body}}</script>