Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-10-12 13:31:01

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

TextMate treatment of Textile in the Write editor?

I poked about in the boards and didn’t see this particular angle addressed, but maybe it’s there somewhere… I’m wondering if it’s possible to make Textile syntax appear in the Write panel editor as it does in TextMate when the Textile file format is active.

It’s not a perfect situation in TextMate, but if it was possible at all to integrate that behavior with Txp, then maybe the associated Textile file(?) could be updated with the needed tweaks.

For example, when you look at a Textile file in TextMate, you see:

  • h1, h2, h3, etc are bold and blue.
  • ordered and unordered lists are bulleted in red.
  • “bq.” is bold-italic, and the following quote is italic
  • bold and strong are bold
  • italic and emphasis are italic
  • and footnotes are treated a little bit with the syntax marks in bold

The Textile file also makes it possible to make a string emphasized or bold, for example by highlighting it then using ctrl+ underscore or ctrl + asterisk to add the surrounding marks in one shot. Which is also rather nice (I’ve been getting used to that in GitHub, which now has me screwed up in other text editors).

Some obvious lacking are:

  • nothing done on tables
  • bq.. and bc.. copy isn’t treated consistently after the first line break
  • An HTML tag (e.g, <div class=”“> … </div> is color-coded by its various parts, until you surround it with “@”, then it just all black-italic.

Anyway, I think it would make it a lot easier to see/distinguish Textile syntax in the editor, and especially if it could be fixed up a bit.

Would something like that be possible?

Offline

#2 2015-10-12 19:31:24

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

Re: TextMate treatment of Textile in the Write editor?

Yes, I would love this! Kind of like iAwriter or Siteleaf does markdown markup, just in Textile. (Siteleaf also has a nifty image preview on rollover in there). I prefer sticking to textile rather than a wysiwyg editor, but it is often just a bit too cryptic for many users. The syntax hints, perhaps coupled with slight formatting shifts (like iAwriter does bullets, headings or blockquotes). It helps make the syntax more self-explanatory. In combination with rah_textile_bar, that would be a winner.

There are quite a few syntax highlighters out there that do textile, but I don’t recall seeing one that actually does it live while typing. Almost all of them either add highlighting to a code block or preview in another window, or an overlay once you’re done typing.

EDIT: the sadly defunct Editorially had it done almost perfectly (in Markdown):


TXP Builders – finely-crafted code, design and txp

Offline

#3 2015-10-12 20:26:04

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

Re: TextMate treatment of Textile in the Write editor?

Yes, exactly. Just like iA Writer, that would be great. The syntax is still shown, but a few visual cues are shown too, where reasonable, to highlight where the syntax is at and indicate what the result will be.

Here’s a screenshot of a TextMate file in Textile mode. It uses a splash of color which would also be okay, though I like the black/gray treatment that iA Writer employs. That would look cleaner, I think. You can also see where the quirks are with some elements, where Textile isn’t applied, but if we could implement something like this and tighten up the textle file against Txp’s use of Textile, that would be something…

Offline

#4 2015-10-13 09:08:06

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: TextMate treatment of Textile in the Write editor?

CodeMirror can do that. Maybe someone would endeavour an integration plugin?

Offline

#5 2015-10-13 10:15:38

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,260
GitHub

Re: TextMate treatment of Textile in the Write editor?

wet wrote #295660:

CodeMirror can do that. Maybe someone would endeavour an integration plugin?

How about this – any good?

Online

#6 2015-10-13 12:29:07

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

Re: TextMate treatment of Textile in the Write editor?

gaekwad wrote #295664:

How about this – any good?

Interesting. Hadn’t seen that one before. Does it actually work in the Write panel too, though, for Textile syntax? I guess I’ll need to ask over there.

Btw, Ulysses works like iA Writer too, and has various Markdown renderings that might inspire.

Last edited by Destry (2015-10-13 12:39:13)

Offline

#7 2015-10-13 12:43:14

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

Re: TextMate treatment of Textile in the Write editor?

wet wrote #295660:

CodeMirror can do that. Maybe someone would endeavour an integration plugin?

Would be cool if we could make it work on your Markdown filter too. That way people have equal treatment per syntax they might choose.

Offline

#8 2015-10-13 13:38:52

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

Re: TextMate treatment of Textile in the Write editor?

gaekwad wrote #295664:

How about this – any good?

Looks like the answer is no, as far as it concerns spiffin.

He’s not seeing the full picture, obviously, and looking from a developer’s pair of glasses. Too bad. Once again the writers/editors are put out.

Offline

#9 2015-10-13 13:53:26

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: TextMate treatment of Textile in the Write editor?

It’s not difficult to implement – I just don’t see the benefit personally.

I happen to be working on a new version of spf_codemirror (with code-folding, tag matching, and a few other features).

I’ll look at adding support for Textile/Markdown syntax-highlighting on the Write page…

Offline

#10 2015-10-13 14:29:54

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

Re: TextMate treatment of Textile in the Write editor?

That would be cool and appreciated, Spiffin.

If you don’t do a lot of writing (versus coding), you may not see the value, understandably. But that doesn’t mean the value isn’t there for a lot of people. iA Writer, Ulysses, and similar web-based, collaborative editors — they all implement keyboard handling of such syntaxes (notably Markdown), and those tools are vastly popular for that reason. Writers love them. There’s a value there. If we brought a little of that value to Textpattern, and especially when wet’s Markdown filter is introduced next release, that’s a boon.

What would really be cool, but not expected, is if we had the ability to edit the color scheme, notably for the Write panel. I’d even be happy to hack it myself if that were possible. I’d just need some explanation where to look. ;)

Offline

#11 2015-10-13 17:09:07

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: TextMate treatment of Textile in the Write editor?

Destry wrote #295685:

What would really be cool, but not expected, is if we had the ability to edit the color scheme, notably for the Write panel. I’d even be happy to hack it myself if that were possible. I’d just need some explanation where to look. ;)

The color schemes are supplied by CodeMirror — check them out here — and you can specify a theme via the plugin’s preferences.

You can make your own by duplicating one from the codemirror/theme directory, editing it (it’s CSS), renaming it, and specifying it in the preferences.

Offline

#12 2015-10-13 20:20:41

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

Re: TextMate treatment of Textile in the Write editor?

Got it. Thanks. Can’t wait to try it.

Offline

Board footer

Powered by FluxBB