[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Simple syntax coloring code
- From: KHMan <keinhong@...>
- Date: Thu, 06 Jan 2011 03:04:53 +0800
On 1/6/2011 2:59 AM, email@example.com wrote:
-- Encode/escape certain characters inside Markdown code runs.
-- The point is that in code, these characters are literals,
-- and lose their special Markdown meanings.
s = s:gsub("%&", "&")
s = s:gsub("<", "<")
s = s:gsub(">", ">")
for k,v in pairs(escape_table) do
s = s:gsub("%"..k, v)
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... :)
Yeah, I have a purely Lua-based one <300 lines that I used in a
simple wiki-style text processor. I'll send it to you shortly.
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia