✨ feat: global/individual toggle for KaTeX and copy button
Allow KaTeX and copy button to be enabled globally or for individual posts.
This commit is contained in:
parent
5cdc18e688
commit
edcfa359ef
@ -143,6 +143,9 @@ copy_button = true
|
|||||||
# Adds backlinks to footnotes (loads ~500 bytes of JavaScripts).
|
# Adds backlinks to footnotes (loads ~500 bytes of JavaScripts).
|
||||||
footnote_backlinks = false
|
footnote_backlinks = false
|
||||||
|
|
||||||
|
# Enable KaTeX for all posts.
|
||||||
|
katex = false
|
||||||
|
|
||||||
# Date format used when listing posts (main page, /blog section, tag posts list…)
|
# Date format used when listing posts (main page, /blog section, tag posts list…)
|
||||||
# Default is "6th July 2049" in English and "%d %B %Y" in other languages.
|
# Default is "6th July 2049" in English and "%d %B %Y" in other languages.
|
||||||
long_date_format = "%d %B %Y"
|
long_date_format = "%d %B %Y"
|
||||||
|
@ -10,25 +10,21 @@ tags = ["funcionalitat", "tutorial"]
|
|||||||
|
|
||||||
Aquest tema no requereix JavaScript obligatori. Opcionalment, pot carregar una quantitat mínima per afegir algunes característiques que són impossibles d'aconseguir amb HTML i CSS.
|
Aquest tema no requereix JavaScript obligatori. Opcionalment, pot carregar una quantitat mínima per afegir algunes característiques que són impossibles d'aconseguir amb HTML i CSS.
|
||||||
|
|
||||||
## Opcions globals
|
## Opcions habilitades globalment
|
||||||
|
|
||||||
Pots habilitar les següents opcions per a totes les pàgines:
|
L'**interruptor de mode clar/fosc** pot habilitar-se configurant `theme_switcher = true` a la secció `[extra]` del teu `config.toml` (~900 bytes de JavaScript).
|
||||||
|
|
||||||
- **Canvi de mode clar/fosc**. Habilitat configurant `theme_switcher = true`. (~900 bytes)
|
## Configuracions que es poden habilitar tant globalment com en publicacions individuals
|
||||||
- **Còpia de blocs de codi amb un sol clic**. Habilitat configurant `copy_button = true`. (~700 bytes)
|
|
||||||
- **Enllaços de retorn de notes a peu de pàgina**. Habilitats configurant `footnote_backlinks = true` (~500 bytes).
|
|
||||||
|
|
||||||
|
Les següents configuracions es poden habilitar globalment per a totes les pàgines o específicament per a publicacions individuals:
|
||||||
|
|
||||||
Aquestes dues configuracions es poden aplicar a la secció `[extra]` del teu fitxer `config.toml`.
|
- [**KaTeX**](@/blog/markdown.ca.md#katex). Habilitat configurant `katex = true` (274 KB).
|
||||||
|
- [**Còpia de blocs de codi amb un sol clic**](@/blog/markdown.ca.md#bloc-de-codi). Habilitada configurant `copy_button = true`. (~700 bytes)
|
||||||
|
- [**Enllaços de retorn de notes al peu de pàgina**](@/blog/markdown.ca.md#1). Habilitats configurant `footnote_backlinks = true` (~500 bytes).
|
||||||
|
|
||||||
- [**Comentaris**](@/blog/comments.ca.md). giscus (2 KB), utterances (1 KB), Hyvor Talk (~800 bytes) o Isso (1KB) es poden habilitar globalment configurant `enabled_for_all_posts = true` a la secció correcta de `config.toml` (`[extra.giscus]`, `[extra.utterances]`, `[extra.hyvortalk]` o `[extra.isso]`).
|
Per habilitar aquestes configuracions globalment, afegeix-les a la secció `[extra]` del teu `config.toml`. Per habilitar-les en publicacions individuals, estableix les variables corresponents a l'apartat `[extra]` del front matter de la publicació.
|
||||||
|
|
||||||
## Configuracions específiques de la pàgina
|
- [**Comentaris**](@/blog/comments.ca.md). giscus (2 KB), utterances (1 KB), Hyvor Talk (~800 bytes) o Isso (1KB) es poden habilitar globalment configurant `enabled_for_all_posts = true` a la secció apropiada del teu fitxer `config.toml` (`[extra.giscus]`, `[extra.utterances]`, `[extra.hyvortalk]` o `[extra.isso]`). Per habilitar comentaris en publicacions individuals, configura el nom del sistema `= true` (per exemple, `hyvort
|
||||||
|
- [**Comentaris**](@/blog/comments.ca.md). giscus (2 KB), utterances (1 KB), Hyvor Talk (~800 bytes) o Isso (1KB) es poden habilitar globalment configurant `enabled_for_all_posts = true` a la secció apropiada del teu fitxer `config.toml` (`[extra.giscus]`, `[extra.utterances]`, `[extra.hyvortalk]` o `[extra.isso]`). Per habilitar comentaris en publicacions individuals, configura el nom del sistema `= true` (per exemple, `hyvortalk = true`) al front matter del post.
|
||||||
Les següents configuracions es poden habilitar en posts específics configurant certes variables a la secció `[extra]` del front matter de la publicació.
|
|
||||||
|
|
||||||
- [**KaTeX**](@/blog/markdown.ca.md#katex) (274 KB) es pot habilitar amb `katex = true`.
|
|
||||||
- [**Comentaris**](@/blog/comments.ca.md). Es poden habilitar assignant el nom del sistema `= true` (per exemple, `hyvortalk = true`).
|
|
||||||
- **Enllaços de retorn de notes a peu de pàgina**. Es poden habilitar amb `footnote_backlinks = true`.
|
|
||||||
|
|
||||||
A part d'això, és un tema ràpid amb HTML i CSS que funciona sense JavaScript. Just com hauria de ser (la majoria de) la web :-)
|
A part d'això, és un tema ràpid amb HTML i CSS que funciona sense JavaScript. Just com hauria de ser (la majoria de) la web :-)
|
||||||
|
@ -10,24 +10,20 @@ tags = ["funcionalidad", "tutorial"]
|
|||||||
|
|
||||||
Este tema no tiene JavaScript obligatorio. Opcionalmente, puede cargar una cantidad mínima para agregar algunas características que son imposibles de lograr con HTML y CSS.
|
Este tema no tiene JavaScript obligatorio. Opcionalmente, puede cargar una cantidad mínima para agregar algunas características que son imposibles de lograr con HTML y CSS.
|
||||||
|
|
||||||
## Opciones globales
|
## Opciones habilitadas globalmente
|
||||||
|
|
||||||
Puedes habilitar las siguientes opciones en todas las páginas:
|
El **interruptor de modo claro/oscuro** puede habilitarse configurando `theme_switcher = true` en la sección `[extra]` de tu `config.toml` (~900 bytes de JavaScript).
|
||||||
|
|
||||||
- **Interruptor de modo claro/oscuro**. Habilitado configurando `theme_switcher = true`. (~900 bytes)
|
## Configuraciones que pueden habilitarse tanto globalmente como en publicaciones individuales
|
||||||
- **Copia de bloques de código con un solo clic**. Habilitado configurando `copy_button = true`. (~700 bytes)
|
|
||||||
- **Enlaces de retorno de notas al pie**. Habilitados configurando `footnote_backlinks = true` (~500 bytes).
|
|
||||||
|
|
||||||
Estas dos configuraciones se pueden aplicar en la sección `[extra]` de tu `config.toml`.
|
Las siguientes configuraciones pueden habilitarse globalmente para todas las páginas o específicamente para publicaciones individuales:
|
||||||
|
|
||||||
- [**Comentarios**](@/blog/comments.es.md). giscus (2 KB), utterances (1 KB), Hyvor Talk (~800 bytes) o Isso (1KB) se pueden habilitar globalmente configurando `enabled_for_all_posts = true` en la sección apropiada de tu archivo `config.toml` (`[extra.giscus]`, `[extra.utterances]`, `[extra.hyvortalk]` o `[extra.isso]`).
|
- [**KaTeX**](@/blog/markdown.es.md#katex). Habilitado configurando `katex = true` (274 KB).
|
||||||
|
- [**Copia de bloques de código con un solo clic**](@/blog/markdown.es.md#bloque-de-codigo). Habilitada configurando `copy_button = true`. (~700 bytes)
|
||||||
|
- [**Enlaces de retorno de notas al pie**](@/blog/markdown.es.md#1). Habilitados configurando `footnote_backlinks = true` (~500 bytes).
|
||||||
|
|
||||||
## Opciones para publicaciones individuales
|
Para habilitar estas configuraciones globalmente, añádelas en la sección `[extra]` de tu `config.toml`. Para habilitarlas en publicaciones individuales, establece las variables correspondientes en el apartado `[extra]` del front matter de la publicación.
|
||||||
|
|
||||||
Las siguientes configuraciones se pueden habilitar en publicaciones específicas configurando ciertas variables en la sección `[extra]` del front matter del post.
|
- [**Comentarios**](@/blog/comments.es.md). giscus (2 KB), utterances (1 KB), Hyvor Talk (~800 bytes) o Isso (1KB) se pueden habilitar globalmente configurando `enabled_for_all_posts = true` en el apartado apropiado de tu archivo `config.toml` (`[extra.giscus]`, `[extra.utterances]`, `[extra.hyvortalk]` o `[extra.isso]`). Para habilitar comentarios en publicaciones individuales, configura el nombre del sistema `= true` (por ejemplo, `hyvortalk = true`) en el front matter del post.
|
||||||
|
|
||||||
- [**KaTeX**](@/blog/markdown.es.md#katex) (274 KB) se puede habilitar con `katex = true`.
|
Aparte de eso, es un tema rápido con HTML y CSS que funciona con JavaScript deshabilitado. Justo como debería ser (en su mayoría) la web :-)
|
||||||
- [**Comentarios**](@/blog/comments.es.md). Se pueden habilitar con el nombre del sistema `= true` (por ejemplo, `hyvortalk = true`).
|
|
||||||
- **Enlaces de retorno de notas al pie**. Se pueden habilitar con `footnote_backlinks = true`.
|
|
||||||
|
|
||||||
Aparte de eso, es un tema rápido con HTML y CSS que funciona con JavaScript deshabilitado. Como debería ser (en su mayoría) la web :-)
|
|
||||||
|
@ -12,22 +12,18 @@ This theme has no mandatory JavaScript. Optionally, it can load a minimal amount
|
|||||||
|
|
||||||
## Globally enabled settings
|
## Globally enabled settings
|
||||||
|
|
||||||
You can enable the following settings for all pages:
|
The **light/dark mode switch** can be enabled by setting `theme_switcher = true` in the `[extra]` section of your `config.toml` (~900 bytes of JavaScript).
|
||||||
|
|
||||||
- **Light/dark mode switch**. Enabled by setting `theme_switcher = true`. (~900 bytes)
|
## Settings that can be enabled globally and for individual posts
|
||||||
- **One-click copy of code blocks**. Enabled by setting `copy_button = true`. (~700 bytes)
|
|
||||||
- **Footnote backlinks**. Enabled by setting `footnote_backlinks = true` (~500 bytes).
|
|
||||||
|
|
||||||
These settings can be applied in the `[extra]` section of your `config.toml` file.
|
The following settings can be enabled globally for all pages or specifically for individual posts:
|
||||||
|
|
||||||
- [**Comments**](@/blog/comments.md). giscus (2 KB), utterances (1 KB), Hyvor Talk (~800 bytes) or Isso (1KB) can be globally enabled by setting `enabled_for_all_posts = true` in the right section of your `config.toml` (i.e. `[extra.giscus]`, `[extra.utterances]`, `[extra.hyvortalk]` or `[extra.isso]`).
|
- [**KaTeX support**](@/blog/markdown.md#katex). Enabled by setting `katex = true` (274 KB).
|
||||||
|
- [**One-click copy of code blocks**](@/blog/markdown.md#code-block). Enabled by setting `copy_button = true`. (~700 bytes)
|
||||||
|
- [**Footnote backlinks**](@/blog/markdown.md#1). Enabled by setting `footnote_backlinks = true` (~500 bytes).
|
||||||
|
|
||||||
## Page-specific settings
|
To enable these settings globally, add them in the `[extra]` section of your `config.toml` file. To enable for individual posts, set the corresponding variables in the `[extra]` section of the post's front matter.
|
||||||
|
|
||||||
The following settings can be enabled on specific posts by setting certain variables in the `[extra]` section of the post's front matter.
|
- [**Comments**](@/blog/comments.md). giscus (2 KB), utterances (1 KB), Hyvor Talk (~800 bytes) or Isso (1KB) can be globally enabled by setting `enabled_for_all_posts = true` in the right section of your `config.toml` (i.e. `[extra.giscus]`, `[extra.utterances]`, `[extra.hyvortalk]` or `[extra.isso]`). To enable comments on individual posts, set the name of the system `= true` (e.g. `hyvortalk = true`) in the post's front matter.
|
||||||
|
|
||||||
- [**KaTeX** support](@/blog/markdown.md#katex) (274 KB) can be enabled by setting `katex = true`.
|
|
||||||
- [**Comments**](@/blog/comments.md) can be enabled by setting the name of the system `= true` (e.g. `hyvortalk = true`).
|
|
||||||
- **Footnote backlinks** can be enabled by setting `footnote_backlinks = true`.
|
|
||||||
|
|
||||||
Other than that, it's a fast theme with HTML and CSS which works with JavaScript disabled. Just the way (most of) the web should be :-)
|
Other than that, it's a fast theme with HTML and CSS which works with JavaScript disabled. Just the way (most of) the web should be :-)
|
||||||
|
@ -36,6 +36,8 @@ katex = true
|
|||||||
+++
|
+++
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Per activar-lo globalment, afeigeix `katex = true` a la secció `[extra]` del teu `config.toml`.
|
||||||
|
|
||||||
Per obtenir un millor rendiment i seguretat, els fitxers JavaScript, CSS i les tipografies de $\KaTeX$ s'allotgen localment.
|
Per obtenir un millor rendiment i seguretat, els fitxers JavaScript, CSS i les tipografies de $\KaTeX$ s'allotgen localment.
|
||||||
|
|
||||||
**Nota**: Després d'activar $\KaTeX$, si vols utilitzar el caràcter \$ sense renderitzar-lo com a expressió matemàtica, escapa'l amb una barra inversa: `\$`.
|
**Nota**: Després d'activar $\KaTeX$, si vols utilitzar el caràcter \$ sense renderitzar-lo com a expressió matemàtica, escapa'l amb una barra inversa: `\$`.
|
||||||
|
@ -36,6 +36,8 @@ katex = true
|
|||||||
+++
|
+++
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Para activarlo globalmente, añade `katex = true` en la sección `[extra]` de tu `config.toml`.
|
||||||
|
|
||||||
Para un mejor rendimiento y seguridad, el JavaScript, CSS y las fuentes de $\KaTeX$ se alojan localmente.
|
Para un mejor rendimiento y seguridad, el JavaScript, CSS y las fuentes de $\KaTeX$ se alojan localmente.
|
||||||
|
|
||||||
**Nota**: Después de habilitar $\KaTeX$, si deseas usar \$ sin representar una expresión matemática, escápalo con una sola barra invertida: `\$`.
|
**Nota**: Después de habilitar $\KaTeX$, si deseas usar \$ sin representar una expresión matemática, escápalo con una sola barra invertida: `\$`.
|
||||||
|
@ -36,6 +36,8 @@ katex = true
|
|||||||
+++
|
+++
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You may enable it globally as well, by setting `katex = true` in the `[extra]` section of your `config.toml`.
|
||||||
|
|
||||||
For enhanced performance and security, the $\KaTeX$ JavaScript, CSS, and fonts are hosted locally.
|
For enhanced performance and security, the $\KaTeX$ JavaScript, CSS, and fonts are hosted locally.
|
||||||
|
|
||||||
**Note**: After enabling $\KaTeX$, if you want to use \$ without rendering a mathematical expression, escape it with a single backslash: `\$`.
|
**Note**: After enabling $\KaTeX$, if you want to use \$ without rendering a mathematical expression, escape it with a single backslash: `\$`.
|
||||||
|
@ -24,13 +24,13 @@
|
|||||||
{% include "partials/footer.html" %}
|
{% include "partials/footer.html" %}
|
||||||
|
|
||||||
{# Add KaTeX functionality (loads CSS and JS) #}
|
{# Add KaTeX functionality (loads CSS and JS) #}
|
||||||
{%- if page.extra.katex and page.extra.katex == true -%}
|
{%- if config.extra.katex and config.extra.katex == true or page.extra.katex and page.extra.katex == true -%}
|
||||||
<link rel="stylesheet" href="{{ get_url(path='katex.min.css', trailing_slash=false) | safe }}">
|
<link rel="stylesheet" href="{{ get_url(path='katex.min.css', trailing_slash=false) | safe }}">
|
||||||
<script defer src="{{ get_url(path='js/katex.min.js', trailing_slash=false) | safe }}"></script>
|
<script defer src="{{ get_url(path='js/katex.min.js', trailing_slash=false) | safe }}"></script>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{# Add copy button to codeblocks #}
|
{# Add copy button to codeblocks #}
|
||||||
{%- if config.extra.copy_button and config.extra.copy_button == true -%}
|
{%- if config.extra.copy_button and config.extra.copy_button == true or page.extra.copy_button and page.extra.copy_button == true -%}
|
||||||
<script defer src="{{ get_url(path='js/copyCodeToClipboard.min.js', trailing_slash=false) | safe }}"/></script>
|
<script defer src="{{ get_url(path='js/copyCodeToClipboard.min.js', trailing_slash=false) | safe }}"/></script>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
@ -36,6 +36,9 @@ copy_button = true
|
|||||||
# Adds backlinks to footnotes (loads ~500 bytes of JavaScripts).
|
# Adds backlinks to footnotes (loads ~500 bytes of JavaScripts).
|
||||||
footnote_backlinks = false
|
footnote_backlinks = false
|
||||||
|
|
||||||
|
# Enable KaTeX for all posts.
|
||||||
|
katex = false
|
||||||
|
|
||||||
# Date format used when listing posts (main page, /blog section, tag posts list…)
|
# Date format used when listing posts (main page, /blog section, tag posts list…)
|
||||||
# Default is "6th July 2049" in English and "%d %B %Y" in other languages.
|
# Default is "6th July 2049" in English and "%d %B %Y" in other languages.
|
||||||
long_date_format = "%d %B %Y"
|
long_date_format = "%d %B %Y"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user