I'd like to see the Ruby Haml bundle recognize ":markdown" and punt
over to that language for proper syntax highlighting in TextMate (or,
in my case at work, e-texteditor).

I went to go add this ("How hard can it be?") but ran into two
problems. Before sharing my work thus far, I wanted to know if anyone
has already dived deep into this and determined it to be intractable.
Can someone state with authority that a TextMate language grammar
cannot properly punt over to Markdown and overcome the issues below?

What I Did
========
At a random point in the patterns at the root of the Ruby Haml
Language Grammar, I dropped this (in JSON notation, as edited within e-
texteditor):
      {
         "begin" : "^(\\s*):markdown\\b",
         "end"   : "^(?!\\1)|^\\1\\S",
         "patterns" : [
            {
               "include" : "text.html.markdown"
            }
         ]
      },

Problem #1: Greedy Matching
======================
For some reason, the above 'worked' (applied the markdown grammar to
just Hello World) on content line this:
  %foo
    :markdown
      **Hello**
      World

  %bar

...but failed (applied the markdown grammar to the %bar line also) on
content like this:
  %foo
    :markdown
      **Hello**
      World
  %bar

This problem seemed solvable, but paled in comparison to...

Problem #2: Extra Indentation
======================
In Markdown, all lines indented past a certain amount become
preformatted literal text. Of course when TextMate applies the
markdown grammar to those lines you don't get any of the syntax
highlighting you'd actually like.

Is anyone here sufficiently ninja at TextMate language grammars to
know if it's possible to use the begin/end for the pattern as above,
but then supply sub-patterns that strips off the (captured from begin
or elsewhere) whitespace and applies the Markdown grammar to just the
content that follows that whitespace on that particular line? This
wouldn't allow Markdown to do any multi-line processing, but would be
better than nothing.

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to h...@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to