Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-16 11:38:49

jeadorf
Plugin Author
From: München, DE
Registered: 2010-04-13
Posts: 12

jea_pygments_txp - syntax highlighting for textpattern with Pygments

A plugin that adds syntax hightlighting to textpattern. It is based on Pygments, a powerful highlighting engine that supports more than 90 languages and predefines a whole bunch of different styles.

This is a support thread for asking questions regarding the plugin, complaining or requesting new features.

Last edited by jeadorf (2020-02-20 19:36:57)

Offline

#2 2010-04-16 11:47:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

Nice one. You’re now a Plugin Author and I moved the topic for you. Welcome to the club ;-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2010-04-16 11:48:48

jeadorf
Plugin Author
From: München, DE
Registered: 2010-04-13
Posts: 12

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

Thank you for moving the support thread to the right place! And the plugin would not exist without your help, anyway.

Offline

#4 2010-04-16 20:57:58

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

Does this only embed code from external files or can you highlight code within the article? From the help it seemed the code must always be a seperate file.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#5 2010-04-17 08:13:10

jeadorf
Plugin Author
From: München, DE
Registered: 2010-04-13
Posts: 12

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

You are right, version 0.1 only supports highlighting code from a file that resides in your file upload directory. Highlighting code within the tag content is not supported yet. This feature is on top of my roadmap for the next release, along with an explicit way to specify the language of the embedded code. I’ll drop you a notice when done.

Offline

#6 2010-04-20 16:05:57

jeadorf
Plugin Author
From: München, DE
Registered: 2010-04-13
Posts: 12

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

Version 0.2 is released. New features / changes:

  • embed code directly in an article
  • new language parameter
  • removed dependency on pygments-snippet-filter
  • available languages and styles listed in plugin options

Download here. Feedback welcome.

Last edited by jeadorf (2010-04-20 16:15:02)

Offline

#7 2010-04-23 15:14:19

rathersplendid
Plugin Author
From: London
Registered: 2008-05-02
Posts: 163
Website

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

This might be a total shot in the dark, but can this be used to highlight the admin-side Pages and Forms textareas? I’m certain I already know the answer but just thought I’d ask….

Thanks by the way!


Admin Themes Prometheus | Stung | <txp:coder/
My Portfolio | ɹǝpuɐz.com | @MrMartineau
<txp:coder /> – Convert your designs into Textpattern-based websites
jQuery Style | @jquerystyle

Offline

#8 2010-04-23 17:40:24

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

rathersplendid wrote:

but can this be used to highlight the admin-side Pages and Forms textareas?

Do you want EditArea?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2010-05-04 20:16:34

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 373
Website

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

Works perfectly! Thanks Julius.


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#10 2010-06-17 17:44:24

tracyde
New Member
Registered: 2010-06-17
Posts: 2

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

Admittedly, I am new to TextPattern so please bare with me. I just installed v0.2 of your plugin and can not get it to work. I do have pygment installed on the webserver (I am currently hosting with DreamHost so had to use the virtualenv) and can run pygment.

I went ahead and tried using the sample python code from your readme and have even copy and pasted your entire readme into a Test article (http://twistedcode.org/articles/5/test), but the only thing that shows up is the actual code in small letters (due to the .pre beforehand I believe).

Please let me know what I am doing wrong.

Offline

#11 2010-06-17 17:54:26

tracyde
New Member
Registered: 2010-06-17
Posts: 2

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

Ok, I apologize for taking up anybody’s time that actually read this. I found out what the issue was, do not enter the pre. before the

<txp:jea_highlight lang=‘python’><notextile>
def hypotenuse(a, b): return sqrt(a*a + b*b);
</notextile></txp:jea_highlight>

Offline

#12 2010-06-17 21:22:41

jeadorf
Plugin Author
From: München, DE
Registered: 2010-04-13
Posts: 12

Re: jea_pygments_txp - syntax highlighting for textpattern with Pygments

No problem at all! And I noticed that there is also some feedback hidden in your post! I might add an inline attribute that allows very short pieces of code to be passed by attribute value instead of entering code within the tag content. That will make testing easier. If you like to avoid the hassle of embedding code directly within a textpattern article’s content, you might rather include code by specifying a file instead. I also confirm that Dreamhost+virtualenv works fine for me, too.

Offline

Board footer

Powered by FluxBB