mirror of
https://github.com/welpo/tabi.git
synced 2025-10-11 07:46:15 +02:00
💄 style: fix numbered code blocks (#437)
This commit is contained in:
parent
cf6385553c
commit
123110ea43
4 changed files with 121 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
+++
|
||||
title = "Ejemplos de Markdown"
|
||||
date = 2023-01-31
|
||||
updated = 2023-09-01
|
||||
updated = 2024-11-23
|
||||
description = "Esta publicación muestra algunos ejemplos de formato Markdown, incluyendo una tabla, bloques de código y etiquetas, citas, tablas y notas al pie de página."
|
||||
|
||||
[taxonomies]
|
||||
|
@ -59,6 +59,42 @@ fn main() {
|
|||
}
|
||||
```
|
||||
|
||||
### Con números de línea
|
||||
|
||||
```rust,linenos
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct TwinPeaksCharacter {
|
||||
name: String,
|
||||
coffee_rating: f32,
|
||||
pie_preference: String,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut black_lodge = HashMap::new();
|
||||
|
||||
black_lodge.insert("agent", TwinPeaksCharacter {
|
||||
name: String::from("Dale Cooper"),
|
||||
coffee_rating: 9999.99,
|
||||
pie_preference: String::from("Damn Fine Cherry"),
|
||||
});
|
||||
|
||||
black_lodge.insert("giant", TwinPeaksCharacter {
|
||||
name: String::from("The Fireman"),
|
||||
coffee_rating: 42.424242,
|
||||
pie_preference: String::from("Garmonbozia"),
|
||||
});
|
||||
|
||||
// Calculate total appreciation of damn fine coffee
|
||||
let total_coffee: f32 = black_lodge.values()
|
||||
.map(|character| character.coffee_rating)
|
||||
.sum();
|
||||
|
||||
println!("☕ Total coffee appreciation: {:.2} cups", total_coffee);
|
||||
}
|
||||
```
|
||||
|
||||
## Etiquetas de código
|
||||
|
||||
En Rust, declaras una variable mutable con `let mut x = 5;`, mientras que en Python, simplemente usas `x = 5`. De manera similar, para imprimir un valor en Rust, utilizarías `println!("Valor: {}", x);`, pero en Python, es tan sencillo como `print(f"Valor: {x}")`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue