Use a simpler :prefix-name: syntax for icon fonts#680
Conversation
acjh
left a comment
There was a problem hiding this comment.
Let's officially deprecate the variables syntax for icons.
yamgent
left a comment
There was a problem hiding this comment.
A search for {{glyphicon still returns files that are using the old syntax.
@Chng-Zhi-Xuan good catch! Turns out a preceding line break from the last |
@yamgent Yes, since these are still used to test variables. Since we are only deprecating the syntax for the next release, I think we still have to keep them to ensure that existing uses don't break until when we remove the syntax altogether. Also, there are some issues related to testing since we will not have static built-in variables after we remove the
|
I think it is fine to swap over to the new syntax completely, We can just add unit tests in |
|
@Chng-Zhi-Xuan By completely, do you mean including Note that this PR does not (should not) introduce a new syntax for variables, just "constant" icons. |
|
@acjh I am referring to the Glyphicons using the old syntax. Since this PR is meant to improve icon syntax only. |
|
@Xenonym, I looked through again and seems ok. However, we should change our documentation and tests to follow the new icon syntax in this PR. "Implicit testing" of old syntax by intentionally leaving some icons with old syntax in templates or tests is not clean. Please do change the Once you're done, I can give the green light 👍 |
- aria-hidden=true is set for icon fonts for accessibility: https://www.filamentgroup.com/lab/bulletproof_icon_fonts.html#accessibility
- convert uses of {{ prefix_name }} to :prefix-name:
- modify tests that rely on {{ prefix_name }} to use other variables
- new example for variables that contain HTML tags to replace the old one which uses {{ prefix_name }}
@Chng-Zhi-Xuan made the necessary changes! Here's a summary:
|
Chng-Zhi-Xuan
left a comment
There was a problem hiding this comment.
Thanks for the changes, looks good 👍
Good point on the <font> element being obsolete. Although I still find numerous instances of using it within our documentation / code base.
@Xenonym Do open up an issue to refactor <font> elements in a separate PR.
|
Gave it a try. Works as intended. Nice work @Xenonym and reviewers. One small nit. This extra space can be misleading (not sure if it was introduced in this PR or not). |
|
That extra space was already present before the icon syntax change PR. The blank space is caused by the Snippet from * _Solid_ (prefix: `fas-`) e.g., :fas-file-code: (actual name `file-code`, MarkBind name **`fas-`**`file-code`)
* _Regular_ (prefix: `far-`) e.g., :fas-file-code: (actual name `file-code`, MarkBind name **`far-`**`file-code`)
* _Brands_ (prefix: `fab-`): e.g., :fab-github-alt: (actual name `github-alt`, MarkBind name **`fab-`**`github-alt`) |
I guess it is a legacy problem. It's better to fix it though. We can sacrifice the bolding. On a related note, I hope we can add a proper way to highlight/bold parts of |
The files were used as a template to build the iconsMap for using variable syntax to insert icons. Since MarkBind#680, we have shifted to another syntax for inserting icons. We made the decision to depreciate the old variable syntax. Thus it renders the current icon .csv files as obsolete. Let's remove these files as well when depreciating the variable syntax for icons.

What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [X] Enhancement to an existing feature
Resolves #612.
What is the rationale for this request?
Currently, we use the
{{ prefix_name }}syntax for inserting icon fonts from Font Awesome and Glyphicons. It would be ideal to support a simpler:prefix-name:syntax, similar to how we support:emoji:.What changes did you make? (Give an overview)
markdown-it-regexpto match:prefix-name:and replace them with the appropriate icon font HTML.aria-hidden="true"to the FA icons to be consistent with Glyphicons and for accessibility.(FA's accessibility documentation, Bulletproof Accessible Icon Fonts)
site-nav.md, thetest_site'ssite-nav.md, and the user guide to use the new:prefix-name:syntax.test_site.vue-straprepo to parse:prefix-name:in<panel>headers.Provide some example code that this change will affect:
Testing instructions:
markbind serve. The icons should render: