From e70c686ab020c0009c08331974fc0937178b452b Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 9 Jan 2015 04:04:48 +0100 Subject: Add rudimentary markdown syntax support The spec is here: http://daringfireball.net/projects/markdown/syntax Currently, it doesn't support Setext headers and hard-wrapped quotes. --- config.def.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/config.def.h b/config.def.h index db41216..b833ed1 100644 --- a/config.def.h +++ b/config.def.h @@ -1218,5 +1218,36 @@ static Syntax syntaxes[] = {{ &colors[COLOR_BRACKETS], }} },{ + .name = "markdown", + .file = "\\.(md|mdwn)$", + .rules = {{ + "(^#{1,6}.*$)", //titles + &colors[COLOR_SYNTAX5], + },{ + "((\\* *){3,}|(_ *){3,}|(- *){3,})", // horizontal rules + &colors[COLOR_SYNTAX2], + },{ + "(\\*\\*.*\\*\\*)|(__.*__)", // super-bolds + &colors[COLOR_SYNTAX4], + },{ + "(\\*.*\\*)|(_.*_)", // bolds + &colors[COLOR_SYNTAX3], + },{ + "(\\[.*\\]\\(.*\\))", //links + &colors[COLOR_SYNTAX6], + },{ + "(^ *([-\\*\\+]|[0-9]+\\.))", //lists + &colors[COLOR_SYNTAX2], + },{ + "(^( {4,}|\t+).*$)", // code blocks + &colors[COLOR_SYNTAX7], + },{ + "(`+.*`+)", // inline code + &colors[COLOR_SYNTAX7], + },{ + "(^>+.*)", // quotes + &colors[COLOR_SYNTAX7], + }} + },{ /* empty last element, array terminator */ }}; -- cgit v1.2.3