vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 77e4a7f9f955c1eb8a4b5abbe596bd5b780f3bcf
parent 4a60a9e68e1d492336a8894c674646d980f78137
Author: jvoisin <julien.voisin@dustri.org>
Date:   Fri,  9 Jan 2015 04:04:48 +0100

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.

Diffstat:
Mconfig.def.h | 31+++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+), 0 deletions(-)

diff --git 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 */ }};