[TxMt] Markdown symbol list idea

Allan Odgaard throw-away-1 at macromates.com
Sun Dec 4 07:22:59 UTC 2005


On 4/12/2005, at 6:48, Charilaos Skiadas wrote:

> [...] This is supposed to only pick lines that start with a capital  
> letter. For some reason though, it doesn't. Any ideas?

Well, the transformation only picks up lines which start with A-Z,  
the scope select still selects all paragraphs.

You could do something like this instead:

    symbolTransformation = '
       s/^\W.*/-/m;
       s/(\w+(?:\W+\w+){,7})\W*(.+)?/$1(?2:…)/m;
    ';

Here I first replace all lines that start with a non-word character  
to '-', which appear as a divider in the list (I actually wanted to  
replace them with nothing, but TM picks up empty entries, which it  
shouldn't).

I went a little overboard with the second line, it matches up to 8  
words, and only when there is a 9th word, will it insert an ellipsis.

The /m option is just to make . match newlines. Probably not  
necessary, as I don't think these get included by the scope selector.




More information about the textmate mailing list