mirror of
https://github.com/tabler/tabler.git
synced 2026-01-25 12:26:30 +00:00
Compare commits
1 Commits
main-rever
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e098fdfaa6 |
@@ -216,13 +216,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) {
|
||||
|
||||
Reference in New Issue
Block a user