[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Simple syntax coloring code
- From: cormullion@...
- Date: Wed, 05 Jan 2011 18:59:59 +0000
Thanks for the helpful replies. Some useful pointers there for
exploration.
What I wanted was to modify the version of Markdown I'm using (the
excellent Lua version from Niklas Frykholm) so that any Lua code
blocks are marked up with <span> tags according to their syntax. The
place to insert the coloring code would be somewhere around here (line
842):
-- Encode/escape certain characters inside Markdown code runs.
-- The point is that in code, these characters are literals,
-- and lose their special Markdown meanings.
function encode_code(s)
s = s:gsub("%&", "&")
s = s:gsub("<", "<")
s = s:gsub(">", ">")
for k,v in pairs(escape_table) do
s = s:gsub("%"..k, v)
end
return s
end
I've played with calling Vim, but - as a newcomer - imagined that the
necessary Lua code had already been written and would be better than
trying to interact with other processes... I had also imagined that it
would be simpler... :)
I'll investigate your scripts, Peter, but it will won't be immediately
because I don't currently have the development tools (eg gcc)
installed on this machine and so can only run pre-built binaries and
Lua source files... :)
thanks!