Markdown doesn't always generate XHTML
    Petite Abeille 
    petite.abeille at gmail.com
       
    Fri Mar 14 16:57:30 EDT 2008
    
    
  
On Mar 14, 2008, at 9:38 PM, Waylan Limberg wrote:
> I know that
> Python-Markdown has an option to not allow any html in a document
> (this "safe_mode" can be set to either replace with a customizable
> message, remove completely, or escape the html). Of course, to stay in
> line with the Markdown standard, it is off by default, but very easy
> to turn on in your code. Other implementations may offer a similar
> option.
Or one could preprocess the text directly before rendering it, e.g.:
aText = aText:gsub( '(`?)(<.->)(`?)', '`%2`' )
aText = markdown( aText )
aText = aText:gsub( '(`)(<.->)(`)', '%2' )
http://dev.alt.textdrive.com/browser/HTTP/WikiService.lua#L281
That way anything between angle brackets is escaped.
Or at least this is what Nanoki, a wiki engine implemented in Lua,  
does to protect the innocent from shooting themselves in the foot :)
http://svr225.stepx.com:3388/nanoki
Try to edit the online demo:
http://svr225.stepx.com:3388/test
In theory, functional anomalies aside, Nanoki's pages should always  
render as valid XHTML.
--
PA
http://alt.textdrive.com/nanoki/
    
    
More information about the Markdown-Discuss
mailing list