next-theme / hexo-theme-next

🎉 Elegant and powerful theme for Hexo.
https://theme-next.js.org
Other
2.42k stars 428 forks source link

Icon Display Problem of Tabs Feature #38

Closed Mister-Kin closed 4 years ago

Mister-Kin commented 4 years ago

Issue Checklist


Expected behavior

I want to use tabs feature of tag plugins with icons. The following are my codes:

{% tabs tabs_name %}
<!-- tab 开源 @osi -->
text
<!-- endtab -->
{% endtabs %}

Actual behavior

The icon didn't work and showed messy.

I realized the problem might be the prefix of Font Awesome. Therefore, I checked the codes of next/scripts/tags/tabs.js and found following code in line 45.

if (!icon.startsWith('fa')) icon = 'fa fa-' + icon;

Does it mean that it would add 'fa fa-' as prefix by default to all icons? If that's true, I couldn't add osi icon in this way because of the prefix of osi icon in Font Awesome 5.13.0 being 'fab fa-'.

Font Awesome 5.x version has more prefixs than 4.x version, like fas, far, fab, not only fa anymore. Could tag plugins support more prefixs for icons?

If my assumption is wrong, how could I solve this problem?

Thanks in advance.

issue-label-bot[bot] commented 4 years ago

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

stevenjoezhang commented 4 years ago

It seems that you have misunderstood String.prototype.startsWith Try this @fab fa-osi

Mister-Kin commented 4 years ago

>_<

Awkward!

Now I understand. Thank you. @fab fa-osi could work.

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. It is possible issue was solved or at least outdated. Feel free to open new for related bugs.