From a9dab5cd4fd71e06d705cd1612588568502ddc07 Mon Sep 17 00:00:00 2001
From: Ben Bridle <ben@derelict.engineering>
Date: Fri, 14 Mar 2025 12:59:16 +1300
Subject: Support labelled internal links

The latest version of the markdown library supports labelled internal
links, which allows an internal link to point to a page but to display
with a different name.
---
 Cargo.lock           | 4 ++--
 Cargo.toml           | 2 +-
 src/generate_html.rs | 7 +++++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index ad0733b..59defee 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -22,8 +22,8 @@ dependencies = [
 
 [[package]]
 name = "markdown"
-version = "3.2.0"
-source = "git+git://benbridle.com/markdown?tag=v3.2.0#883a2a63023ea9b1e4b2bb51831ea1dafcb7346a"
+version = "3.3.0"
+source = "git+git://benbridle.com/markdown?tag=v3.3.0#df45ffb3affb7cb1d53b567b70fef721353ccffe"
 
 [[package]]
 name = "paste"
diff --git a/Cargo.toml b/Cargo.toml
index de58476..94a9ccb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,7 @@ edition = "2021"
 
 [dependencies]
 vagabond = { git = "git://benbridle.com/vagabond", tag = "v1.1.0" }
-markdown = { git = "git://benbridle.com/markdown", tag = "v3.2.0" }
+markdown = { git = "git://benbridle.com/markdown", tag = "v3.3.0" }
 recipe = { git = "git://benbridle.com/recipe", tag = "v1.4.0" }
 log = { git = "git://benbridle.com/log", tag = "v1.1.2" }
 switchboard = { git = "git://benbridle.com/switchboard", tag = "v1.0.0" }
diff --git a/src/generate_html.rs b/src/generate_html.rs
index eea25dc..55bd8ef 100644
--- a/src/generate_html.rs
+++ b/src/generate_html.rs
@@ -297,8 +297,11 @@ fn line_to_html(line: &Line, page: &Page, website: &Website) -> String {
                 let text = &sanitize_text(text, false); html.push_str(&format!("<code>{text}</code>")) }
             Token::Math(text) => {
                 let text = &sanitize_text(text, false); html.push_str(&format!("<span class='math'>{text}</span>")) }
-            Token::InternalLink(name) => {
-                let ParsedLink { path, class, label } = parse_internal_link(name, page, website);
+            Token::InternalLink{ label: link_label, path } => {
+                let ParsedLink { path, class, mut label } = parse_internal_link(path, page, website);
+                if !link_label.is_empty() {
+                    label = link_label.to_string();
+                }
                 html.push_str(&format!("<a href='{path}' class='{class}'>{label}</a>"))
             }
             Token::ExternalLink { label, path } => {
-- 
cgit v1.2.3-70-g09d2