We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81a976a commit 9a04d81Copy full SHA for 9a04d81
packages/mdbook-trpl/src/listing/mod.rs
@@ -221,7 +221,13 @@ struct Listing {
221
222
impl Listing {
223
fn opening_html(&self) -> String {
224
- let figure = String::from("<figure class=\"listing\">\n");
+ let id_attribute = if let Some(number) = self.number.as_ref() {
225
+ format!(" id=\"listing-{number}\"")
226
+ } else {
227
+ String::new()
228
+ };
229
+
230
+ let figure = format!("<figure class=\"listing\"{id_attribute}>\n");
231
232
match self.file_name.as_ref() {
233
Some(file_name) => format!(
0 commit comments