Open TrevorBurnham opened 12 years ago
Here's another case where the highlighting for the :markdown
filter isn't greedy enough:
!!! 5
p
:markdown
This is Markdown
This is Markdown, too
In the "not greedy enough case," the Markdown highlighting continues if and only if the blank line between the two paragraphs is indented. Jade, however, doesn't care whether it's indented or not.
Thanks TrevorBurnham for pointing out that inserting intended blank lines "fixes" this behavior. This is at least a workaround.
Apparently this is caused by Markdown's treatment of any indented text as raw <pre><code>
.
Markdown's Language Grammar, lines 126~130:
raw_block = {
begin = '(^|\G)([ ]{4}|\t)';
name = 'markup.raw.block.markdown';
while = '(^|\G)([ ]{4}|\t)';
};
(If you're not fluent in regex, what that says, as best as I can tell, is that while
Markdown sees indented code (4 spaces or a literal indent character), it will keep treating text as raw <pre><code>
. That's why inserting an unindented line stops the greedy parsing.)
I'm not sure why the markup.raw.block.markdown
continues after the actual text.html.markdown
should stop, but it implies another workaround:
include = 'text.html.markdown';
, or replace it with include = 'plain.text';
(TextMate will automatically create a copy of your Jade bundle at ~/Library/Application Support/("TextMate" for TM 1, "Avian" for TM 2)/Bundles/Jade.tmbundle
; the original is preserved at /Pristine Copy/Bundles
. So you don't need to worry about editing the bundle.)
This still doesn't restore Markdown's syntax highlighting, though.
Here's a test case:
This renders as
http://cl.ly/030K0s3J1D1g3l0n1v2v
Jade correctly interprets the
p
as being a separate element, not part of the Markdown, so the highlighting is inaccurate.