Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-01-10 15:21:36

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

Forum syntax highlighting

Since the forum upgrade in December 2013 this forum supports syntax highlighting.
The supported language identifiers currently are

  • apacheconf
  • clike
  • coffeescript
  • css
  • git
  • haml
  • javascript (or js)
  • json
  • less
  • markup (or html)
  • markdown
  • nginx
  • perl
  • php
  • ruby
  • sass
  • scss
  • sql
  • stylus
  • textile
  • txp
  • yaml

I want to encourage you using it, the results are more structured, hence easier to read, and faults in code can be found quicker. It’s super simple:

bc. txp
<txp:article limit='<txp:variable name="post_limit" />' pageby="10" />

The extra effort in code here are three letters, txp, after the code block opener bc. and a return after the identifier.

The above example results in the following code display:

<txp:article limit='<txp:variable name="post_limit" />' pageby="10" />

Edit: Post completely rewritten.

Last edited by uli (2017-02-10 14:30:46)


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

Offline

#2 2014-01-10 20:35:22

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Forum syntax highlighting

awesome. and great that there’s now syntax highlighting with txp.

<txp:article_custom category="appreciated" limit="1" wraptag="div">
  <h2><txp:title /></h2>
  <txp:body />
</txp:article_custom>

Offline

#3 2014-01-10 23:46:06

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: Forum syntax highlighting

Thanks for the very nice <txp:subject />-tag. ;-)

Offline

#4 2014-01-11 00:48:33

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Forum syntax highlighting

GugUser wrote #278020:

Thanks for the very nice <txp:subject />-tag. ;-)

LOL brain fart. title, TITLE!

Offline

#5 2014-01-11 02:25:18

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: Forum syntax highlighting

mrdale, how could you change the text without the standard indicating that the post was modified?

Strange.

Offline

#6 2014-01-11 02:59:26

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

Re: Forum syntax highlighting

GugUser wrote #278023:

mrdale, how could you change the text without the standard indicating that the post was modified?

Since the forum upgrade, moderator’s checkboxes “Silent edit” are checked by default, whereas that one from the prior version was unchecked. You could edit and simply ignore the checkbox. Now you have to be aware of the checkbox and tick it.
Els has asked already to change that new feature back.

Added: Incidentally came across Gocom’s reply.

Last edited by uli (2014-01-11 17:14:16)


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

Offline

#7 2015-07-02 10:51:00

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Forum syntax highlighting

This should be a sticky in every category of the boards. It’s too overlooked in one little unpopular room.

Offline

#8 2016-10-20 17:42:33

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Forum syntax highlighting

which syntaxes are supported by code coloring?

Offline

#9 2016-10-20 19:01:55

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Forum syntax highlighting

uli wrote #278012:

Supported language identifiers include: apollo, bash, c, coffee, cs, clj, css, dart, go, hs, html, java, js, json, lisp, lua, ml, n, perl, php, proto, python, ruby, rust, scala, sh, sql, tex, vb, vhdl, wiki, xml, xsl, xq and yaml and … txp.


TXP Builders – finely-crafted code, design and txp

Offline

#10 2016-10-21 15:06:44

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Forum syntax highlighting

If I only learned how to read ;)

Offline

Board footer

Powered by FluxBB