osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Help with markdown syntax highlighting - msg#00000

List: editors.nano.general

Mail Archive Navigation:
by Date: Next Date Index by Thread: Next Thread Index

I've been writing some regexes to enable markdown syntax highlighting
in nano. My regex skill is limited, so I'm looking for some pointers
on perfecting the rule set.

Markdown syntax is explained here:

http://daringfireball.net/projects/markdown/syntax

Here are my highlighting rules from my .nanorc:

syntax "markdown" "\.txt$"
# Quotations
color cyan "^>.*"
# Emphasis
color green "_.*_"
color green "\*.*\*"
# Strong emphasis
color brightgreen "\*\*.*\*\*"
color brightgreen "__.*__"
# Underline headers
color brightblue "^====(=*)"
color brightblue "^----(-*)"
# Hash headers
color brightblue "^#.*"
# Linkified URLs (and inline html tags)
color brightmagenta start="<" end=">"
# Links
color brightmagenta "\[.*\]\(.*\)"
# Reference-style links
color brightmagenta "\[.*\]( )?\[.*\]"
# Link id's:
color brightmagenta "^\[.*\]:( )+.*"
# Code spans
color brightyellow "`.*`"
# Code blocks
color brightyellow "^( ).*"
# Inline images
color brightmagenta "!\[.*\]\(.*\)"
# Reference-style images
color brightmagenta "!\[.*\]\[.*\]"

They have the following limitations:

Emphasis, strong emphasis and code spans that go over multiple lines
will not be highlighted properly (the highlighting only works within
one line). How can I improve these rules to go over multiple lines?

If you end a line with two spaces in markdown it is meaningful. But
ofcourse it's not easy to see in an editor whether a line ends with
trailing spaces or not. How can I highlight a pair of spaces at the
end of a line?

For underlined headers, it would be nice to colour the actual text of
the header, not just the underline. This means colouring the line
above the line that matches the --- or === pattern. How can this be
done?

I've coloured text that appears in-between < and > characters, which
has the effect of colouring HTML tags. Markdown allows for arbitrary
HTML to be embedded within the markdown code. But is it possible to
highlight the HTML itself, as opposed to only the HTML tags?

Thanks!

--
https://wiki.ubuntu.com/SeanHammond


Thread at a glance:

Next Message by Date:

Astoundi.ng Of.fer F.or Reasonably Price.d Dr.ugs

AmAtBuFiPaPhSoUlVaXaZy biivsporxienmatrlinaba enanaricl te -amumx n - - -et- rm - -- - -in99 241710 59e .011177795 0.7.9.99.0- 0 9.7..9.0 009900.90 99999 0 9 74 .9 9 Go here Thousands of tons of deadly radioactive rods of spent nuclear fuel and waste have accumulated at three California nuclear power plants because the federal government has failed to open a permanent nuclear burial site in Nevada that was supposed to be. _______________________________________________ Help-nano mailing list Help-nano@xxxxxxx http://lists.gnu.org/mailman/listinfo/help-nano

Next Message by Thread:

Astoundi.ng Of.fer F.or Reasonably Price.d Dr.ugs

AmAtBuFiPaPhSoUlVaXaZy biivsporxienmatrlinaba enanaricl te -amumx n - - -et- rm - -- - -in99 241710 59e .011177795 0.7.9.99.0- 0 9.7..9.0 009900.90 99999 0 9 74 .9 9 Go here Thousands of tons of deadly radioactive rods of spent nuclear fuel and waste have accumulated at three California nuclear power plants because the federal government has failed to open a permanent nuclear burial site in Nevada that was supposed to be. _______________________________________________ Help-nano mailing list Help-nano@xxxxxxx http://lists.gnu.org/mailman/listinfo/help-nano
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!