feat: code blocks beta

This commit is contained in:
obvTiger 2025-03-27 17:28:51 +01:00
parent 362b7aa15e
commit 1ecb6d8682
19 changed files with 756 additions and 94 deletions

View file

@ -52,8 +52,23 @@ const safeStringify = (obj) => {
}
};
/**
* Generates a random ID string suitable for use as an HTML element ID.
* @param {number} [length=8] - The length of the random ID
* @returns {string} - A random alphanumeric ID with bp_ prefix
*/
const generateRandomId = (length = 8) => {
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
let result = 'bp_';
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return result;
};
module.exports = {
escapeHTML,
toKebabCase,
safeStringify
safeStringify,
generateRandomId
};