Hey guys,
I’ve created a plugin for Discourse, which adds additional code fences and syntax highlighting buttons to the composer toolbar.
The plugin, documentation and all future updates can be found here: https://github.com/ThomDietrich/discourse-plugin-code-fences-buttons
The available buttons in your toolbar are configured through the plugin settings. Currently there is one javascript option and one with free to choose syntax highlighting. Options are easily extendable, just duplicate one of the two. Pull requests welcome!
It looks like the plugin.rb file isn’t specifying the icons it needs. There should be lines like this near the top:
register_svg_icon "icon-name" if respond_to?(:register_svg_icon)
These weren’t needed in older versions of Discourse, but are now.
I’ve also found that some of the icon name change over time, I guess due to changes on the Font Awesome side, which has made some of my own plugin icons disappear until I found the new names for them.
It would be cool if the custom button setting could accept a comma separated list that generated a dropdown menu for the button in the editor. I’d love to have a whole range of languages in there