From: Waylan L. <wa...@gm...> - 2008-02-18 23:58:56
|
We have a few bugs in our tracker that highlight a limitation of the inlinePatterns. I'd like some feedback about which behavior is preferred or if we should look for a different way of doing things. Currently, it's only possible for one of the following to work in python-markdown: A bold [**link**](http://example.com) currently works fine. A **bold [link](http://example.com)** currently does not work. For those that care, here's why: Markdown parses the first line and finds the link. The label `**link**` is then run through all remaining inlinePatterns and properly identified as bold text. The second line is parsed and, as the link pattern is run first, the link is found and a link element is created. That line of text is now represented as the following list in python: ["A **bold ", <markdown.element>, "** currently does not work.\n"] Any remaining patterns are then run against each string in that list. The problem should be obvious by now. The opening and closing `**` are in separate strings split by the link element, so no match is made. Finally, the list is looped through and any remaining strings are converted to textnodes and the entire thing is added to the dom inside a paragraph element. The easy solution is to reverse the order of the inlinePatterns. But then we can't do the first example as the link syntax is broken up in the same way. Now, if no one ever uses that syntax, that would be fine. Of course, both should work, so we may need a new approach to the inlinePatterns. Any ideas? -- ---- Waylan Limberg wa...@gm... |