Code fences toolbar button plugin


#1

Hey guys,
We are looking into adding the ability to insert

code fences with ('syntax highlighting')

as a button to the toolbar because code snippets are important in our installation and not all users know about code fences. The plugin can be found here: GitHub - ThomDietrich/discourse-plugin-code-fences-buttons: Discourse Plugin: Code Fences Buttons (cfbtn)

I am having a problem though. Descriptor and placeholder for the buttons are not replaced by the internationalized representations. So the string “cf_ohitems_button_title” defined here is not replaced by the corresponding string in my config/locales/client.en.yml. What am I missing?

Thanks!


(cpradio) #2

Are you doing this on a development machine or on a docker installation?

If on a development machine, did you try clearing the cache, using rm -Rf tmp/cache?
If docker, did you run ./launcher rebuild app?


#3

Damn I knew it was something this simple. I already had the feeling this is cache related (development machine with vagrant) and cleared the cache. Now I had to realize I had tried to clear /tmp/cache :tired_face:
Thanks!
Btw. I guess you already realized that I forked your spoiler-ui plugin. If you want to pull something back, go for it! (I did some “deduplication” in spoiler-ui.js.es6 for example)


#4

There is actually one more function you maybe can help me with. I want options for activating/deactivating buttons in the admin>plugins>settings pane so you only see the php button if this is all your users will need.
I have my config/settings.yml file with 4 settings but only “codefence_buttons_enabled” is shown.


(cpradio) #5

You didn’t update the plugin.rb to reference the 3 other site settings.


#6

And how? :slight_smile:
Putting them line by line will only show the last one and putting all options in an array crashes my admin area.


(cpradio) #7

Oh, actually that was bad advice anyway, give me more time to look at your repo


(cpradio) #8

Hmm… I just cloned your repo and it works fine for me…


#9

I just needed to search for openhab? :joy:
Aah the time :slight_smile: Thank you very much!

I’ll clean everything up and add options for commonly used syntax languages.
Can you or one of the moderators move this thread to plugins?

Best! Thomas


(cpradio) #10

I can, though it may be more useful to post a new topic there (so it doesn’t have all of this back and forth).

Maybe provide some screenshots to show the composer changes and what not.


#11

Topic resolved.
The working plugin can be found here:


(Régis Hanol) #12