我想在textmate中爲markdown啓用代碼摺疊。如何在TextMate中爲折扣啓用代碼摺疊?
具體來說,我希望任何標題(文本前面有一個或多個'#'字符)作爲將在它與下一個標題和/或水平規則之間切換塊的行。例如:
# Level 1 Heading - I'd like the block below to fold
The text I'd like to fold away
## Level 2 Heading
More text...
BBEdit似乎爲降價做到了這一點。 TextMate支持代碼摺疊,適用於表示帶有成對(和相同縮進)大括號的塊的語言。
我知道TextMate提供了兩個變量,您可以在語言語法文件中設置,但我需要更多的正則表達式才能比我具有的才能。以下就是目前居住在降價語言語法的代碼摺疊設置:
foldingStartMarker = '(?x)
(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)\b.*?>
|<!--(?!.*-->)
|\{\s*($|\?>\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/)))
)';
foldingStopMarker = '(?x)
(</(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)>
|^\s*-->
|(^|\s)\}
)';
任何幫助,不勝感激!