symphonycms / docs.getsymphony.com

The official repository for the Symphony CMS documentation site
2 stars 2 forks source link

Pygments not working? #22

Closed tachyondecay closed 9 years ago

tachyondecay commented 9 years ago

I've got the following block in concepts/extensions/delegates.md:

{% highlight php %}
  public function getSubscribedDelegates()
  {
    return array(
      array(
        'page' => '/delegatepage/',
        'delegate' => 'DelegateName',
        'callback' => 'extensionFunction'
      ),
    );`
  }
{% endhighlight %}

This is the right way to trigger the Pygments highlighter in Jekyll, right? At first I thought it was just a problem with Pygments on my computer, but it's not working here either, so I think we need to fix the config (unless I'm doing something wrong).

bernardodiasc commented 9 years ago

I think we need to include this styles to work properly: https://github.com/mojombo/tpw/blob/master/css/syntax.css

tachyondecay commented 9 years ago

The CSS file helped, but the real culprit was … (drum roll) CodeMirror, which I didn’t realize Factory was using for highlighting.

I have no idea why CodeMirror's syntax highlighting wasn't working—I tried disabling Pygments entirely, and I fixed a bug in the JS that identified the language being highlighted. Still no joy.

So my solution is to disable CodeMirror highlighting, simply because it was the easiest thing to do to get code highlighting working.

Note: If you want to highlight PHP and don’t want to include <?php, you need to add the startinline argument, like so:

{% highlight php startinline %}
public function getSubscribedDelegates()
{
  return array(
    array(
      'page' => '/delegatepage/',
      'delegate' => 'DelegateName',
      'callback' => 'extensionFunction'
    ),
  );
}
{% endhighlight %}