Skip to content

Instantly share code, notes, and snippets.

@hekt
Created March 5, 2012 19:27
Show Gist options
  • Save hekt/1980496 to your computer and use it in GitHub Desktop.
Save hekt/1980496 to your computer and use it in GitHub Desktop.
Markdown syntax highlighting in GNU nano
##
## markdown.nanorc 1.0.1 (March 06 2012)
## https://gist.github.com/1980496
##
## license: MIT License
##
## copyright (C) 2012 hekt <http://www.hekt.org/>.
##
syntax "markdown" "\.(md|mdt|mdwn)$"
## comments
color brightblue start="<!--" end="-->"
## header
color red "^#+[ \t]+.*"
color red "^.+\n([=-]{4,})"
## blockquotes
color green "^>[ \t]+.*"
## lists
color cyan "^([0-9]+\.|[\*+-])[ \t]"
## code block
color green "\n\n(([ \t]{4,}|\t).*\n?)+"
## horizontal rules
color red "^[*-_]([*-_]{2,}|([ \t][*-_]){2,})$"
## links and images
color magenta "\[[^]]*\][ \t]?(\([^)]*\)|\[[^]]*\])"
## references
color brightblue "^[ \t]{0,3}\[.*\]:[ \t]+.*"
## emphasis
color yellow "\*([^*[ \t]]([^*]|\\\*)*[^*[ \t]]|[^*[ \t]])\*"
color yellow "_([^_[ \t]]([^_]|\\_)*[^_[ \t]]|[^_[ \t]])_"
color brightyellow "\*{2}([^ \t]([^*]|\\\*\*|[^*]\*[^*])*[^ \t]|[^*[ \t]])\*{2}"
color brightyellow "__([^ \t]([^_]|\\__|[^_]_[^_])*[^ \t]|[^_ \t])__"
## code
color green "`+([^`]|\\`)+`+"
## automatic links
color cyan "<.+[:@].+>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment