1

Does anyone have experience with adding formatted code snippets to a blog post using Lemoon? I have been using Syntax Highlighter in other systems and like it fine, but I'm wondering first if there's a built in solution in Lemoon. I noticed that the system uses codemirror for HTML view for editing content and wondered if that might also be used for formatting code snippets. Thanks.

Jeremy Foster
  • 4,673
  • 3
  • 30
  • 49

1 Answers1

1

Lemoon has a built in code EDITOR that uses codemirror. Just decorate your field appropriately as described here. This applies only to the administrative section of Lemoon.

You could use this field type to write your markup and snippets, but I guess you are looking for a better way to insert code snippets in your blog posts.

It is possible to configure the standard Lemoon HTML editor (TinyMce 3.x) to use a plugin that enables you to insert code snippets. https://github.com/RichGuk/syntaxhl looks promising (haven’t tried it though). You will find the TinyMce config files in the app_data\settings folder.

Another alternative is to switch to the HTML source and manually add the pre or code elements as needed.

As for presenting the snippets on your site, you could use codemirror (configured as read-only) or perhaps you are better off sticking with SyntaxHighlighter. In any way, you have to include the appropriate JavaScript files and handle the initialization yourself.