Fix links in table of contents caused by variation selector-16 (U+FE0F)

This commit is contained in:
Zach Borboa
2024-08-24 14:11:30 -04:00
parent 357d1201a0
commit 28abb78e2e
2 changed files with 15 additions and 3 deletions
+2 -2
View File
@@ -12,12 +12,12 @@ PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.
---
- [⚙️ Installation](#-installation)
- [⚙️ Installation](#%EF%B8%8F-installation)
- [📋 Requirements](#-requirements)
- [🚀 Quick Start and Examples](#-quick-start-and-examples)
- [📖 Available Methods](#-available-methods)
- [🔒 Security](#-security)
- [🛠️ Troubleshooting](#-troubleshooting)
- [🛠️ Troubleshooting](#%EF%B8%8F-troubleshooting)
- [🧪 Testing](#-testing)
- [🤝 Contributing](#-contributing)
+13 -1
View File
@@ -51,7 +51,19 @@ script=$(cat <<'EOF'
preg_match_all('/^### (.*)/m', $data, $matches);
$toc = [];
foreach ($matches['1'] as $match) {
$slug = strtolower(preg_replace('/[^A-Za-z-]/', '', str_replace(' ', '-', $match)));
$slug = urlencode(
strtolower(
str_replace(
' ',
'-',
preg_replace(
'/[^A-Za-z\x{FE0F} ]/u',
'',
$match,
),
)
)
);
$href = '#' . $slug;
$toc[] = '- [' . $match . '](' . $href . ')';
}