1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-21 17:34:25 +04:00

Merge branch 'main' of https://github.com/tabler/tabler into dev

This commit is contained in:
codecalm
2025-10-24 00:08:42 +02:00

View File

@@ -213,13 +213,20 @@ export default function (eleventyConfig) {
});
const generateUniqueId = (text) => {
return text
let id = text
.replace(/<[^>]+>/g, "")
.replace(/\s/g, "-")
.replace(/[^\w-]+/g, "")
.replace(/--+/g, "-")
.replace(/^-+|-+$/g, "")
.toLowerCase();
// Ensure ID doesn't start with a number (invalid HTML)
if (/^[0-9]/.test(id)) {
id = "h" + id;
}
return id;
}
eleventyConfig.addFilter("headings-id", function (content) {