xkisu / craftcodesnippets

[NOT MAINTAINED] Use craftcleancode instead

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This plugin adds the option to insert code snippets in the rich text editor, as well as adding a custom code snippet fieldtype that can be used with custom templates to create things like Github Gist styled posts.

Notice

If you JUST want the code fieldtype, I have a second plugin Clean Code which implements a standalone code fieldtype a lot cleaner and with better usage. This works better for single code fields and code blocks in a Matrix.

Installation

Create a folder called redactorcodesnippets in the craft/plugins directory. Enter the directory and either:

Next go to the plugins page in the admin control panel and enable the plugin.

Enabling Rich Text code Snippets

To add the code snippets button in the Rich Text fields, edit craft/configs/redactor/Standard.json and add codesnippets to the plugins array. Done!

Using the Code Snippet field type in templates

<pre class="code">{{ entry.code }}</pre>

Replace entry."code" with the id for your code snippet field. The pre tag will automatically be detected and code formatting will be applied.

Notes

Please report and bugs and suggestions in the issues section on Github :)

TODO

  • Add Ace configuration for theme, font size, etc.

About

[NOT MAINTAINED] Use craftcleancode instead

License:MIT License


Languages

Language:CSS 52.6%Language:JavaScript 37.5%Language:HTML 5.5%Language:PHP 4.4%