Jump to content

Recommended module / solution for displaying syntax highlighted code?


saml
 Share

Recommended Posts

I'm using processwire to power my (mostly) coding blog, and have had problem finding a stable solution for including code snippets from various langauges, to display them with proper formatting and syntax highlighting etc.

I finally ended up just embedding gists (gist.github.com) since it was the only thing that would not mess up totally with the HTML on the page, etc, but that is some extra work, creating a new gist for every little code snippet you want to show.

So, I was wondering what other use for this purpose, and what seems to be the best solution right now?

Link to comment
Share on other sites

So where do you run into problems? Entering the code on the back-end? Using CKEditor or plain text?

Or displaying on the front-end? If you are able to enter your code snippets in the back-end between for example:

<pre><code>...</code></pre>

You could use something like https://highlightjs.org/ to syntax highlight it on your blog pages in the front-end.

Lots of options really, that depend also on your input scenario.

  • Like 1
Link to comment
Share on other sites

Hi, Yeah, I guess probably my problem was in part that I hoped to be able to use a rich text editor together with my solution, since I really like the manual scaling-feature, for automatically creating thumbs.

But indeed, it should not be hard to add some kind of solution in the front-end, that parses out any kind of "wrapper-syntax", and formats the code. Didn't think about that ... tend to forget how powerful this aspect of pw is, and how it opens up new approaches to how to solve these problems :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...