I've been trying to set the foldingStartMarker and foldingStopMarker for a simplified variant of Markdown but have had no success. The file would look something like this
# First heading #
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse vel nunc. Suspendisse egestas erat vitae pede. Phasellus quis libero et tortor commodo auctor. Sed et erat. Aliquam sed lectus. Fusce semper elit nec ipsum. Morbi sem nisl, tristique id, venenatis quis, gravida sed, neque. Etiam ut felis. Curabitur leo magna, molestie vitae, blandit et, fringilla vitae, purus.
# Second heading #
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse vel nunc. Suspendisse egestas erat vitae pede. Phasellus quis libero et tortor commodo auctor. Sed et erat.
Aliquam sed lectus. Fusce semper elit nec ipsum. Morbi sem nisl, tristique id, venenatis quis, gravida sed, neque. Etiam ut felis. Curabitur leo magna, molestie vitae, blandit et, fringilla vitae, purus.
# Third heading #
etc
I'd like to fold so that only the heading lines show.
The foldingStartMarker is easy:
foldingStartMarker = '^# +';
But I can't get a foldingStopMarker that works. What I'd like to use is a blank line followed by a positive lookahead to a line that starts with a hash and a space, but
foldingStopMarker = '^$\n(?=^# +)';
doesn't work, even though that regex works in the Find dialog box.
Are the start and stop markers restricted to single line patterns? The manual suggests that, but it isn't explicit. Does anyone have any ideas?
-- Dr. Drang
On 22 Dec 2006, at 16:03, Dr. Drang wrote:
Are the start and stop markers restricted to single line patterns? The manual suggests that, but it isn't explicit.
Yes
Does anyone have any ideas?
Check out the section folding in the LateX bundle. They match comments:
% (fold) % (end)
As html comments work in markdown, perhaps the scheme could be adapted.
Best, Mark
On Dec 22, 2006, at 10:13 AM, Mark Eli Kalderon wrote:
On 22 Dec 2006, at 16:03, Dr. Drang wrote:
Are the start and stop markers restricted to single line patterns? The manual suggests that, but it isn't explicit.
Yes
I was afraid of that. I really don't want to clutter up my file with unnecessary comments or other content-free lines just to get folding working. Has there been any discussion of loosening the folding rules in TM 2.0? I've seen nothing beyond this message from quite a while ago
http://article.gmane.org/gmane.editors.textmate.general/3980/ match=folding+pattern
And thanks for fixing the subject line.
-- Dr. Drang
On 22 Dec 2006, at 16:59, Dr. Drang wrote:
On Dec 22, 2006, at 10:13 AM, Mark Eli Kalderon wrote:
On 22 Dec 2006, at 16:03, Dr. Drang wrote:
Are the start and stop markers restricted to single line patterns? The manual suggests that, but it isn't explicit.
Yes
I was afraid of that. I really don't want to clutter up my file with unnecessary comments or other content-free lines just to get folding working. Has there been any discussion of loosening the folding rules in TM 2.0? I've seen nothing beyond this message from quite a while ago
http://article.gmane.org/gmane.editors.textmate.general/3980/ match=folding+pattern
And thanks for fixing the subject line.
I hadn't heard anything, but perhaps you just need to match the section header and separate the sections by horizontal rules:
# My section
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
* * *
# My second section
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
* * *
That way, the only content-free lines would be the rules. I think bsag's Journal bundle did something like that.
Best, Mark
Sorry about omitting the subject from the first post.
On Dec 22, 2006, at 10:03 AM, Dr. Drang wrote:
I've been trying to set the foldingStartMarker and foldingStopMarker for a simplified variant of Markdown but have had no success. The file would look something like this ...
-- Dr. Drang
Regexes are matched on a per-line basis. IIRC, each line includes the trailing newline, but it doesn't include the preceeding one.
Maybe you should try '^(?=# +)', or possibly using \A instead of ^ (I don't know what the \A vs ^ semantics are in the grammar matching).
On Dec 22, 2006, at 11:03 AM, Dr. Drang wrote:
But I can't get a foldingStopMarker that works. What I'd like to use is a blank line followed by a positive lookahead to a line that starts with a hash and a space, but
foldingStopMarker = '^$\n(?=^# +)';
doesn't work, even though that regex works in the Find dialog box.
Are the start and stop markers restricted to single line patterns? The manual suggests that, but it isn't explicit. Does anyone have any ideas?