yuanqing / create-figma-plugin

:battery: The comprehensive toolkit for developing plugins and widgets for Figma and FigJam
https://yuanqing.github.io/create-figma-plugin/
MIT License
935 stars 89 forks source link

Escaping CSS class names for improved rendering #182

Open enes-sahin opened 1 year ago

enes-sahin commented 1 year ago

Fix: Rendering of CSS Class Names with Special Characters

In standard CSS naming conventions, class names can include alphanumeric characters, hyphens, and underscores. However, special characters require escaping to ensure proper rendering. This pull request introduces a regex-based solution that replaces special characters with their corresponding escape sequences. This fix guarantees correct rendering of class names containing special characters.

With this fix, the following code snippets can now be displayed correctly:

<div class="!bg-red-500">...</div>
<div class="py-0.5">...</div>
<div class="w-[100px]">...</div>
<div class="hover:text-gray-200">...</div>