mirror of
https://github.com/welpo/tabi.git
synced 2025-10-10 23:38:53 +02:00
✨ feat: support Zola's native code block names (#489)
This commit is contained in:
parent
6837f6f4f1
commit
61793b2e56
23 changed files with 228 additions and 195 deletions
|
@ -1,7 +1,7 @@
|
|||
+++
|
||||
title = "Shortcodes personalitzats"
|
||||
date = 2023-02-19
|
||||
updated = 2024-12-28
|
||||
updated = 2025-02-15
|
||||
description = "Aquest tema inclou alguns shortcodes personalitzats útils que pots utilitzar per millorar les teves publicacions. Ja sigui per mostrar imatges que s'adapten als temes clar i fosc, o per donar format a una secció de referències amb un aspecte professional, aquests shortcodes personalitzats t'ajudaran."
|
||||
|
||||
[taxonomies]
|
||||
|
@ -11,7 +11,7 @@ tags = ["funcionalitat", "shortcodes"]
|
|||
toc = true
|
||||
toc_levels = 2
|
||||
quick_navigation_buttons = true
|
||||
add_src_to_code_block = true
|
||||
code_block_name_links = true
|
||||
mermaid = true
|
||||
social_media_card = "social_cards/ca_blog_shortcodes.jpg"
|
||||
+++
|
||||
|
@ -191,23 +191,55 @@ Tots els altres shortcodes d'imatges poden utilizar l'amplada completa assignant
|
|||
|
||||
### Mostrar ruta o URL
|
||||
|
||||
Mostra una ruta o URL al següent bloc de codi trobat. Si comença amb "http", es convertirà en un enllaç. Particularment útil quan s'utilitza en conjunció amb el [shortcode de text remot](#text-remot).
|
||||
Pots mostrar una ruta o URL per a un bloc de codi utilitzant la sintaxi nativa de Zola:
|
||||
|
||||
{{ admonition(type="warning", title="IMPORTANT", text="Aquesta funcionalitat requereix JavaScript. Per activar-la, configura `add_src_to_code_block = true` a la secció `[extra]` de la teva pàgina, secció, o `config.toml`.") }}
|
||||
{{ aside(text="Requereix Zola 0.20.0 o superior.") }}
|
||||
|
||||
{{ add_src_to_code_block(src="https://github.com/welpo/doteki/blob/main/.gitignore") }}
|
||||
````
|
||||
```rust,name=src/main.rs
|
||||
fn main() {
|
||||
println!("Hola, món!");
|
||||
}
|
||||
```
|
||||
````
|
||||
|
||||
```.gitignore
|
||||
{{ remote_text(src="https://raw.githubusercontent.com/welpo/doteki/main/.gitignore") }}
|
||||
Això renderitza:
|
||||
|
||||
```rust,name=src/main.rs
|
||||
fn main() {
|
||||
println!("Hola, món!");
|
||||
}
|
||||
```
|
||||
|
||||
Si estableixes el `name` com una URL (és a dir, comença amb `http` o `https`), pots convertir-lo en un enllaç clicable. Això és particularment útil quan s'utilitza juntament amb el [shortcode de text remot](#text-remot).
|
||||
|
||||
{{ admonition(type="warning", title="JavaScript necessari", text="La funció d'URLs clicables requereix JavaScript. Per habilitar-la, configura `code_block_name_links = true` a la secció `[extra]` de la teva pàgina, secció, o `config.toml`.") }}
|
||||
|
||||
```.gitignore,name=https://github.com/welpo/doteki/blob/main/.gitignore
|
||||
__pycache__/
|
||||
*coverage*
|
||||
.vscode/
|
||||
dist/
|
||||
```
|
||||
|
||||
### Suport de shortcode heretat
|
||||
|
||||
El shortcode `add_src_to_code_block` segueix funcionant per retrocompatibilitat però serà descontinuat en una versió futura. Si us plau, utilitza la sintaxi nativa de Zola:
|
||||
|
||||
```
|
||||
# Forma antiga (descontinuada):
|
||||
{{/* add_src_to_code_block(src="ruta/al/fitxer.rs") */}}
|
||||
|
||||
# Forma nova (recomanada):
|
||||
```rust,name=ruta/al/fitxer.rs
|
||||
```
|
||||
|
||||
#### Ús
|
||||
|
||||
````
|
||||
{{/* add_src_to_code_block(src="https://github.com/welpo/doteki/blob/main/.gitignore") */}}
|
||||
|
||||
```.gitignore
|
||||
__pycache__/
|
||||
**pycache**/
|
||||
*coverage*
|
||||
.vscode/
|
||||
dist/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
+++
|
||||
title = "Shortcodes personalizados"
|
||||
date = 2023-02-19
|
||||
updated = 2024-12-28
|
||||
updated = 2025-02-15
|
||||
description = "Este tema incluye algunos shortcodes personalizados útiles que puedes utilizar para mejorar tus publicaciones. Puedes mostrar imágenes que se adapten a los temas claro y oscuro, dar formato a una sección de referencias con un aspecto profesional, y más."
|
||||
|
||||
[taxonomies]
|
||||
|
@ -11,7 +11,7 @@ tags = ["funcionalidad", "shortcodes"]
|
|||
toc = true
|
||||
toc_levels = 2
|
||||
quick_navigation_buttons = true
|
||||
add_src_to_code_block = true
|
||||
code_block_name_links = true
|
||||
mermaid = true
|
||||
social_media_card = "social_cards/es_blog_shortcodes.jpg"
|
||||
+++
|
||||
|
@ -190,28 +190,48 @@ Todos los otros shortcodes de imágenes pueden usar el ancho completo asignando
|
|||
|
||||
### Mostrar ruta o URL
|
||||
|
||||
Muestra una ruta o URL en el siguiente bloque de código encontrado. Si comienza con "http", se convertirá en un enlace. Particularmente útil cuando se usa junto con el [shortcode de texto remot](#texto-remoto).
|
||||
Puedes mostrar una ruta o URL para un bloque de código usando la sintaxis nativa de Zola:
|
||||
|
||||
{{ add_src_to_code_block(src="https://github.com/welpo/doteki/blob/main/.gitignore") }}
|
||||
|
||||
```.gitignore
|
||||
{{ remote_text(src="https://raw.githubusercontent.com/welpo/doteki/main/.gitignore") }}
|
||||
```
|
||||
|
||||
{{ admonition(type="warning", title="IMPORTANT", text="Esta característica requiere JavaScript. Para habilitarla, configura `add_src_to_code_block = true` en la sección `[extra]` de tu página, sección, o `config.toml`.") }}
|
||||
|
||||
#### Uso
|
||||
{{ aside(text="Requiere Zola 0.20.0 o superior.") }}
|
||||
|
||||
````
|
||||
{{/* add_src_to_code_block(src="https://github.com/welpo/doteki/blob/main/.gitignore") */}}
|
||||
```rust,name=src/main.rs
|
||||
fn main() {
|
||||
println!("¡Hola, mundo!");
|
||||
}
|
||||
```
|
||||
````
|
||||
|
||||
```.gitignore
|
||||
Esto renderiza:
|
||||
|
||||
```rust,name=src/main.rs
|
||||
fn main() {
|
||||
println!("¡Hola, mundo!");
|
||||
}
|
||||
```
|
||||
|
||||
Si estableces el `name` como una URL (es decir, comienza con `http` o `https`), puedes convertirlo en un enlace clickable. Esto es particularmente útil cuando se usa junto con el [shortcode de texto remoto](#texto-remoto).
|
||||
|
||||
{{ admonition(type="warning", title="JavaScript requerido", text="La función de URLs clickables requiere JavaScript. Para habilitarla, configura `code_block_name_links = true` en la sección `[extra]` de tu página, sección, o `config.toml`.") }}
|
||||
|
||||
```.gitignore,name=https://github.com/welpo/doteki/blob/main/.gitignore
|
||||
__pycache__/
|
||||
*coverage*
|
||||
.vscode/
|
||||
dist/
|
||||
```
|
||||
````
|
||||
|
||||
### Soporte de shortcode heredado
|
||||
|
||||
El shortcode `add_src_to_code_block` sigue funcionando por retrocompatibilidad, pero será descontinuado en una versión futura. Por favor, usa la sintaxis nativa de Zola:
|
||||
|
||||
```
|
||||
# Forma antigua (descontinuada):
|
||||
{{/* add_src_to_code_block(src="ruta/al/archivo.rs") */}}
|
||||
|
||||
# Forma nueva (recomendada):
|
||||
```rust,name=ruta/al/archivo.rs
|
||||
```
|
||||
|
||||
## Shortcodes de texto
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
+++
|
||||
title = "Custom shortcodes"
|
||||
date = 2023-02-19
|
||||
updated = 2024-12-28
|
||||
updated = 2025-02-15
|
||||
description = "This theme includes some useful custom shortcodes that you can use to enhance your posts. Whether you want to display images that adapt to light and dark themes, or format a professional-looking reference section, these custom shortcodes have got you covered."
|
||||
|
||||
[taxonomies]
|
||||
|
@ -11,7 +11,7 @@ tags = ["showcase", "shortcodes"]
|
|||
toc = true
|
||||
toc_levels = 2
|
||||
quick_navigation_buttons = true
|
||||
add_src_to_code_block = true
|
||||
code_block_name_links = true
|
||||
mermaid = true
|
||||
social_media_card = "social_cards/blog_shortcodes.jpg"
|
||||
+++
|
||||
|
@ -191,28 +191,48 @@ All other image shortcodes can be made into full-width by setting the optional p
|
|||
|
||||
### Show source or path
|
||||
|
||||
Display a path or URL on the next code block found. If it starts with "http", it will become a link. Particularly useful when used in conjunction with the [remote text shortcode](#remote-text).
|
||||
You can display a path or URL for a code block using Zola's native syntax:
|
||||
|
||||
{{ add_src_to_code_block(src="https://github.com/welpo/doteki/blob/main/.gitignore") }}
|
||||
|
||||
```.gitignore
|
||||
{{ remote_text(src="https://raw.githubusercontent.com/welpo/doteki/main/.gitignore") }}
|
||||
```
|
||||
|
||||
{{ admonition(type="warning", title="IMPORTANT", text="This feature requires JavaScript. To enable it, set `add_src_to_code_block = true` on the `[extra]` section of your page, section, or `config.toml`.") }}
|
||||
|
||||
#### Usage
|
||||
{{ aside(text="Requires Zola 0.20.0 or later.") }}
|
||||
|
||||
````
|
||||
{{/* add_src_to_code_block(src="https://github.com/welpo/doteki/blob/main/.gitignore") */}}
|
||||
```rust,name=src/main.rs
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
```
|
||||
````
|
||||
|
||||
```.gitignore
|
||||
This renders:
|
||||
|
||||
```rust,name=src/main.rs
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
```
|
||||
|
||||
If you set the `name` to a URL (i.e. it starts with `http` or `https`), you can turn it into a clickable link. This is particularly useful when used in conjunction with the [remote text shortcode](#remote-text).
|
||||
|
||||
{{ admonition(type="warning", title="JavaScript required", text="The clickable URL feature requires JavaScript. To enable it, set `code_block_name_links = true` on the `[extra]` section of your page, section, or `config.toml`.") }}
|
||||
|
||||
```.gitignore,name=https://github.com/welpo/doteki/blob/main/.gitignore
|
||||
__pycache__/
|
||||
*coverage*
|
||||
.vscode/
|
||||
dist/
|
||||
```
|
||||
````
|
||||
|
||||
### Legacy shortcode support
|
||||
|
||||
The `add_src_to_code_block` shortcode is still supported for backward compatibility but will be deprecated in a future release. Please use Zola's native syntax shown above instead:
|
||||
|
||||
```
|
||||
# Old way (deprecated):
|
||||
{{/* add_src_to_code_block(src="path/to/file.rs") */}}
|
||||
|
||||
# New way (preferred):
|
||||
```rust,name=path/to/file.rs
|
||||
```
|
||||
|
||||
## Text shortcodes
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue