feat: code blocks beta
This commit is contained in:
parent
362b7aa15e
commit
1ecb6d8682
19 changed files with 756 additions and 94 deletions
|
@ -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
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue