# Code Fences Highlighting Buttons Plugin

**URL:** https://meta.discourse.org/t/code-fences-highlighting-buttons-plugin/46661
**Category:** Plugin
**Created:** [2016年六月30日 12:43 UTC](https://meta.discourse.org/t/code-fences-highlighting-buttons-plugin/46661 "2016-06-30T12:43:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Mazzen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mazzen/32/121178_2.png) [@Mazzen](https://meta.discourse.org/u/Mazzen)
#### Post date: [2016年六月30日 12:43 UTC](https://meta.discourse.org/t/code-fences-highlighting-buttons-plugin/46661/1 "2016-06-30T12:43:58Z")

</div>

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: [GitHub - ThomDietrich/discourse-plugin-code-fences-buttons: Discourse Plugin: Code Fences Buttons (cfbtn) · GitHub](https://github.com/ThomDietrich/discourse-plugin-code-fences-buttons)

 ![](https://global.discourse-cdn.com/meta/original/3X/b/0/b0047de713ec30219e443f7a48b72178318af385.png)

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!

---

<div class="post-metadata">

### Author: ![AGulev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/agulev/32/184605_2.png) [@AGulev](https://meta.discourse.org/u/AGulev)
#### Post date: [2020年六月21日 08:41 UTC](https://meta.discourse.org/t/code-fences-highlighting-buttons-plugin/46661/2 "2020-06-21T08:41:36Z")

</div>

此插件在面板中停止显示图标。有人知道如何修复吗？

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/9/a9a3130d6007871dbe1bfcae30bcfddd9939ca4a.png)

---

<div class="post-metadata">

### Author: ![LeoDavidson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leodavidson/32/119574_2.png) [@LeoDavidson](https://meta.discourse.org/u/LeoDavidson)
#### Post date: [2020年六月21日 09:51 UTC](https://meta.discourse.org/t/code-fences-highlighting-buttons-plugin/46661/3 "2020-06-21T09:51:22Z")

</div>

看起来 plugin.rb 文件没有指定所需的图标。在文件顶部附近应该包含类似以下的代码行：

```ruby
register_svg_icon "icon-name" if respond_to?(:register_svg_icon)

```

这些在旧版本的 Discourse 中并不需要，但现在则是必需的。

我还发现，有些图标的名称会随时间发生变化，我推测这是由于 Font Awesome 方面的更新所致，这导致我的一些插件图标消失，直到我找到了它们的新名称。

---

<div class="post-metadata">

### Author: ![Mazzen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mazzen/32/121178_2.png) [@Mazzen](https://meta.discourse.org/u/Mazzen)
#### Post date: [2021年三月23日 23:15 UTC](https://meta.discourse.org/t/code-fences-highlighting-buttons-plugin/46661/4 "2021-03-23T23:15:14Z")

</div>

图标问题已修复，插件确认再次正常运行：slight\_smile:

> <https://github.com/ThomDietrich/discourse-plugin-code-fences-buttons/pull/5>
>
> Resolves #4 
> 
> Update icons from fontawsome 4 to 5.

---

<div class="post-metadata">

### Author: ![ssvenn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ssvenn/32/86740_2.png) [@ssvenn](https://meta.discourse.org/u/ssvenn)
#### Post date: [2021年六月19日 10:42 UTC](https://meta.discourse.org/t/code-fences-highlighting-buttons-plugin/46661/5 "2021-06-19T10:42:50Z")

</div>

插件很棒！

如果自定义按钮设置能接受逗号分隔的列表，并在编辑器中生成下拉菜单，那就太棒了。我希望能在那里包含多种语言 🙂
