Search

Am I right in assuming that the best way (or at least one way) to do this would be to create a text formatter extension that did something like run the code through geshi or some other code formatter?

I like the idea of saving the content in it’s formatted state because it’s so easy to output in the template (like the markdown formatter etc), but is it possible to nest or chain these formatters?

For example, it would be nice to be able to use markdown but have a code block marked with tags to make it run though a syntax highlighting formatter.

Can I take it that no-one else wishes to make a blog/site with symphony that can have syntax-coloured code snippets in it (or at least the option of)?!

Perhaps I’ll just try and write the formatter and see how it goes!!

I’m not sure if anyone’s done it in pure XSLT or as a symphony extension, but Rowan wrote a very fast and capable one in PHP called bitter. I believe it is currently used for syntax highlighting in the debug pages in Symphony

There was some chat of Proposal for a post formatter standard but I don’t think it ever went anywhere. If it’s purely XML-based languages to highlight you want then you might want to read XML Syntax Highlighting which describes how highlighting is achieved on this forum (complete with a tutorial) and some links to other JavaScript highlighters.

I’m not sure whether text formatters can be chained. So if one selects Markdown, the output cannot then be parsed using GeSHi or another parser.

You could write an additional text formatter which implements Markdown first, and then parses the HTML (XML) output and applies GeSHi to the contents of pre or code elements.

Thanks Nick.

Is it possible to hook into the core so that I can fiddle templated output before it gets rendered?

Otherwise I will likely just try what you suggested and try to implement dual markdown/geshi or something similar.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details