Sublime Forum

Textile - show headings using show_overlay

#1

Hi

Is there a way to get show_overlay to show textile headings? In a similar way to textmate’s ‘go to symbol’?

Thanks
Mark

0 Likes

#2

Okay, discovered how to get goToSymbol working for Textile.

Did some reading at the following links about showInSymbolList and symbolTransformation.
http://manual.macromates.com/en/preferences_items.html
http://manual.macromates.com/en/navigation_overview#customizing_the_list.html

The TextMate “Symbol List: Heading” for Textile was missing from the Sublime Textile directory. After tweaking the regex, I ended up putting the following into “Packages/Textile/Symbol List - Heading.tmPreferences”.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
 <dict>
  <key>name</key>
  <string>Symbol List: Heading</string>
  <key>scope</key>
  <string>text.html.textile markup.heading.textile</string>
  <key>settings</key>
  <dict>
    <key>showInSymbolList</key>
    <integer>1</integer>
    <key>symbolTransformation</key>
    <string>
    s/\s*$//;       # strip spaces
    s/^\s*//;
    s/^(h[1-6])\.(.*)$/$1$2/;
    s/^h1//;        # indent headers
    s/^h2/ /;
    s/^h3/  /;
    s/^h4/   /;
    s/^h5/    /;
    s/^h6/     /;
  </string>
  </dict>
  <key>uuid</key>
  <string>a849a69b-4f44-46f6-afec-030e65224b0f</string>
</dict>
</plist>

Basically I trimmed down the spacing and (naively) replaced the following

    s/(^(h[1-6])(<>=()]+)?)(\(^)]*\)|{^}]*})*(\.)/$2/;

with

  s/^(h[1-6])\.(.*)$/$1$2/;

Cheers
Mark

0 Likes