(meta has many many themes, but luckily thanks to @kris.kotlarek we have an add to all themes buttonā¦ got to sort out progress there, cause it takes a while to do its magic)
I never got into BB script tags, nor have I hand-coded FontAwesome, so the practice of using an empty tag pair has always seemed strange to me. Is that by popular convention, or is there a webcraft reason for using tag pairs? Also, can they have stuff between them, does that affect the text?
First when I wrote the wrap BBCode feature, @sam explicitly asked to me support 3 formats:
[wrap=foo][/wrap]
[wrap=foo]bar[/wrap]
[wrap=foo]
bar
[/wrap]
This is done to be consistent with our existing BBCode usage in Discourse.
I could have a better syntax as: [icon=times] but then it would have to be a plugin and not a theme component.
As an experimentation, I think itās fine as it is today, and if people were to use it a lot, we could think of having a plugin do this with a more concise syntax.
Another idea I have had is to add an API to add autocompletes symbol in the composer just like we have fore users/categories/emojisā¦ But Iām afraid this would be a nightmare with multiple components choosing their own symbolā¦
Oh! I need to add support for another bbcode and those) thought that Iād use this as a starting point, but youāre saying that the wrap stuff is handled in core, which explains why I canāt find how itās handled by your theme component.
My current solution is to use the linked words component and an ugly regex, but Iām still struggling to add the necessary classes to the links.
Right Iāve looked at it a dozen times. And printed out the code for your component and stared at it for hours, trying to understand if the degree to which itās javascript or ember that I donāt understand. I canāt add a [foo] tag without a plugin? Or can I some how replace wrap in your code with foo to cover my new bbcode?
No you canāt. Because part of it is server side. If you want your own custom BBCode you will have to write a plugin and look at how wrap is implemented for example:
Thanks! Itās starting to make sense. Iāve not had this much trouble learning a new language since C++ and objective Pascal in 1990.
My current regex hack almost works. Iāll need to decide whether to go the plugin route or stick with my hack (and figure out how to add the classes).
At least now I understand why I canāt find that wrap in the theme component!
Use an icon wrap in a sentence in a post. eg This is an icon [wrap=icon id=far-check-square][/wrap]
Highlight the relevant text and āQuoteā
Icon goes super big in quoted excerpt
This is what the syntax looks like when highlight quoted:
[quote="JammyDodger, post:1, topic:294, full:true"]
This is an icon ![](/svg-sprite/grumpy.jammydodger.monster/icon/222222/far-check-square.svg)
[/quote]
This is a reply where it gets massive
Though quoting it using the speech bubble in the format bar works fine.
Can you provide an example? Your screenshot shows a ticked checkbox and I have no issue selecting it on my test instance (as well as other icons probably not used by Discourse like x-ray.
I see the issue. The component searches by looking at whether there is a wrapper with d-wrap class; but there is no wrapper if the provided icon is not from the subset. It creates an image as SVG instead.
If you quote the images, the component does nothing, as there is no wrapper (and the image is converted to markdown resulting in an image without any class)
Does this mean I need to have an svg_icons field in settings.yml available in my theme? Or could I use any svg_icons field available from any enabled theme-components too? And if that is the case would adding this field to this theme-component make sense?