improve markdown

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2013-01-14 00:14:30 -05:00
parent 0806e467fe
commit 86ea8ad835
1 changed files with 7 additions and 1 deletions

View File

@ -18,6 +18,11 @@ LineGrammar.rules = [
PatternRule('eol', r'\n'), PatternRule('eol', r'\n'),
] ]
class WordGrammar(Grammar): pass
WordGrammar.rules = [
PatternRule('word', r'[A-Za-z0-9_]+'),
]
class MarkdownGrammar(Grammar): pass class MarkdownGrammar(Grammar): pass
MarkdownGrammar.rules = [ MarkdownGrammar.rules = [
PatternRule('md.head1', r'^#.+'), PatternRule('md.head1', r'^#.+'),
@ -56,7 +61,7 @@ MarkdownGrammar.rules = [
RegionRule('md.tt', r'``', MarkdownGrammar, r'``'), RegionRule('md.tt', r'``', MarkdownGrammar, r'``'),
RegionRule('md.bold', r'\*', MarkdownGrammar, r'\*'), RegionRule('md.bold', r'\*', MarkdownGrammar, r'\*'),
RegionRule('md.tt', r'`', MarkdownGrammar, r'`'), RegionRule('md.tt', r'`', WordGrammar, r'`'),
PatternRule('md.escaped', r'\\.'), PatternRule('md.escaped', r'\\.'),
PatternRule('md.word', r'[a-zA-Z\'"\-]+'), PatternRule('md.word', r'[a-zA-Z\'"\-]+'),
@ -145,6 +150,7 @@ class Markdown(Fundamental):
'md.bold.end': hi_orange, 'md.bold.end': hi_orange,
'md.tt.start': lo_orange, 'md.tt.start': lo_orange,
'md.tt.word': lo_orange,
'md.tt.null': lo_orange, 'md.tt.null': lo_orange,
'md.tt.md.word': lo_orange, 'md.tt.md.word': lo_orange,
'md.tt.end': lo_orange, 'md.tt.end': lo_orange,