This project is read-only.

Syntax Highlighting and BlogEngine 3.0

Jul 26, 2014 at 7:31 AM
is there a straightforward way to add syntax highlighting feature to Blogengine 3.0?
i realy need it.
Jul 26, 2014 at 4:01 PM
Edited Jul 26, 2014 at 4:02 PM
I think we already discussed it. To clarify:
  • Standard theme has code highlighting and other themes can implement it same way.
  • To add code block from web editor, you add html like this:
<pre class="brush: js">
  // your code here
  • Live writer has plugins for many code formaters.
We could add a button to editor to inject "pre" block (2), but not everyone want and need highlighting and if theme does not implement it, this button does not make sense.
Jul 27, 2014 at 10:31 PM
Hi Mojtaabaa,

The best Snytax Highlighter to use is:

You just insert the following below in your theme:

<link rel="stylesheet" href="/path/to/styles/default.css">
<script src="/path/to/highlight.pack.js"></script>

and then use <pre> tags for your code and that is it!

The Snytax Highlighter auto detects the language the code is, so you don't have to specify C# or HTML
it does all of it for you.

Even works when you multiple languages in the same page.

On top of that you have 20+ themes to choice from:

You can have a Visual Studio, GitHub, Google Code, School Book, and etc to choice from, lots of different options for themes.

It is also very light code wise so not much of a resource load.