From: gordon p. <wgo...@gm...> - 2011-05-04 18:17:19
|
Waylan, Thanks for the reply. It is good to know the markdown parser can handle any input without choking. I will just use a simple lambda function that returns no errors as a validator to add markdown to my system. -- Gordon On Wed, May 4, 2011 at 2:01 PM, Waylan Limberg <wa...@gm...> wrote: > Gordon, > > AFAIK there is no Markdown validator. Markdown parsers generally are > expected to be able to take any text string and parse it. Of course, > if the input is not valid markdown syntax, the returned result will > not be as expected - but the end user should be able to see the > undesired results and make edits. This is a feature, not a bug. > Perhaps you need to implement a preview step for your users for this > purpose. > > BTW, our markdown parser should never choke on any input text. If > you're aware of input which raises an error, that is a bug (please > file a report [1]). The parser should just be passing unrecognized > syntax through unmodified. Of course, the parser may misinterpret > non-markdown syntax as markdown syntax which results in odd output. > That is not a bug - just bad input which should be edited in the > preview stage. I suggest testing some questionable input on numerous > markdown implementations using Babelmark [2] to see what I mean. > > If you want to filter out specific types of input that normally would > get passed through (and our "safe mode" won't cover it), you should be > looking for a separate filtering library - which could either filter > before or after the markdown parser. See bleach [3] as an example. > > [1]: http://github.com/waylan/Python-Markdown/issues > [2]: http://babelmark.bobtfish.net > [3]: http://github.com/jsocol/bleach > > On Tue, May 3, 2011 at 5:48 PM, gordon pendleton <wgo...@gm...> > wrote: > > Hi, > > > > I am adding the Markdown markup language as an option for user input into > my > > web app. I need to be able to validate the syntax of user submitted > content > > to ensure the markup will render properly before accepting the > submission. > > How can I verify that the input contains valid Markdown syntax? I did > not > > see any error reporting mechanisms I could hook into in the code. How > > should I go about this? > > > > Thanks, > > Gordon > > > > > ------------------------------------------------------------------------------ > > WhatsUp Gold - Download Free Network Management Software > > The most intuitive, comprehensive, and cost-effective network > > management toolset available today. Delivers lowest initial > > acquisition cost and overall TCO of any competing solution. > > http://p.sf.net/sfu/whatsupgold-sd > > _______________________________________________ > > Python-markdown-discuss mailing list > > Pyt...@li... > > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > > > > > > > > -- > ---- > \X/ /-\ `/ |_ /-\ |\| > Waylan Limberg > |