mirror of
https://github.com/zoriya/yoshiki.git
synced 2026-05-31 17:53:35 +00:00
Fix css name sanitization
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yoshiki",
|
||||
"version": "0.3.4",
|
||||
"version": "0.3.5",
|
||||
"author": "Zoe Roux <zoe.roux@sdg.moe> (https://github.com/AnonymusRaccoon)",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -43,7 +43,8 @@ const stateMapper: {
|
||||
const sanitize = (className: unknown) => {
|
||||
const name = typeof className === "string" ? className : JSON.stringify(className);
|
||||
if (name === undefined) return "undefined";
|
||||
return name.replaceAll(/[^\w\d_]/g, "");
|
||||
// Keep - as a _ for minus symbols.
|
||||
return name.replaceAll("-", "_").replaceAll(/[^\w\d_]/g, "");
|
||||
};
|
||||
|
||||
type PreprocessBlockFunction = (block: { [key: string]: unknown }) => { [key: string]: unknown };
|
||||
|
||||
Reference in New Issue
Block a user