refactor: add pull-2, icon label, icon repeat
This commit is contained in:
+10
-1
@@ -59,8 +59,17 @@ const marked = new Marked()
|
||||
}
|
||||
}
|
||||
|
||||
const label = token.attrs?.label as string | undefined;
|
||||
const inner = label ? `<span class="icon-label-stroke">${label}</span><span class="icon-label">${label}</span>` : "";
|
||||
const style = globalIconPrefix ? `style="--icon-src: url('${globalIconPrefix}/${iconName}.${extension}')"` : '';
|
||||
return `<icon ${style} class="icon-${iconName} ${token.attrs?.class || ""}"></icon>`;
|
||||
const iconHtml = `<icon ${style} class="icon-${iconName} ${token.attrs?.class || ""}">${inner}</icon>`;
|
||||
|
||||
const repeat = parseInt(`${token.attrs?.repeat || ''}`);
|
||||
const join = token.attrs?.join || '';
|
||||
const separator = join ? `<${join}></${join}>` : '';
|
||||
if(isNaN(repeat) || repeat < 1) return iconHtml;
|
||||
|
||||
return Array(repeat).fill(iconHtml).join(separator);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user